| | | |  |  | |  |
15.04.2004, 23:23
|
#11 (permalink)
| | Mamber
Join Date: Apr 2004 Location: Houston, TX
Posts: 56
| Re: Different frontpage template Quote: |
Originally Posted by richardt Code: $cur_template = $mainframe->getTemplate(); And replace with this (I've included the same line but commented out): Code: //$cur_template = $mainframe->getTemplate();
if ($option == "com_frontpage"){
$cur_template = "TEMPLATE_NAME";
} else {
$cur_template = $mainframe->getTemplate();
} This code determines whether the user is viewing the frontpage or not, and the displays a different template for that page only...
Let me know if you need a hand getting this to work  |
When I do this, I get the following error code when trying to access my site: Code: Warning: Unknown(/srv/www/htdocs/idea/index.php): failed to open stream: Permission denied in Unknown on line 0
Warning: (null)(): Failed opening '/srv/www/htdocs/idea/index.php' for inclusion (include_path='.:/usr/share/php') in Unknown on line 0 I made a backup of the index.php file before I edited it. However, when I restored my index.php file after I got the error, it still gives me the same error and won't let me into the site. I can, foortunately, get to the admin section of my site.
Any thoughts on how to fix this?
Thanks,
Eric |
| |
15.04.2004, 23:47
|
#12 (permalink)
| | Expert Mamber
Join Date: Apr 2004 Location: Melbourne
Posts: 385
| Re: Different frontpage template Hmm... where did you put this code? Did you take off any PHP tags?
If you can, paste the codes that you modified here so that people could help diagnose your problem.
__________________
"If you cannot win, make the one ahead of you break the record."
| Visualdensity.com |
|
| |
16.04.2004, 16:00
|
#13 (permalink)
| | Mamber
Join Date: Apr 2004 Location: Houston, TX
Posts: 56
| Re: Different frontpage template That's just it... I changed the code in the index.php file in the root mambo directory.
I put the code exactly where richardt said (by replacing the $cur_template = $mainframe->getTemplate(); with the new PHP code) and I received those errors. However, I did make a back up of the index.php BEFORE I modified it. After I received those errors, I removed the lines that I changed. When that did not fix those errors, I restored my index.php backup and I am still receiving those errors.
I have to get this site working again, so I'm going to try and re-install Mambo and see if that corrects the problem.
ok. the reinstallation of Mambo didn't work. In fact, the problem is worse than I thought. I even tried to create a completely different directory with a different Mambo installation and I still get the following error: Code: Warning: Unknown(/srv/www/htdocs/idea/index.php): failed to open stream: Permission denied in Unknown on line 0
Warning: (null)(): Failed opening '/srv/www/htdocs/idea/index.php' for inclusion (include_path='.:/usr/share/php') in Unknown on line 0 Has anyone seen this before? I am running on SuSE Linux 9.0 and I don't know much about it. I also should have tried the debugging mode in the Mambo admin, but I might be beyond that point now.
12:30PM: OK. I think these errors/warnings have to do with an improperly setup of SuSE Linux 9.0. Specifically I think it relates to the path & permissions. Does anyone know where I can go to get help on this? Maybe some good SuSE Linux forums?
Thanks,
Eric
Last edited by er16004; 16.04.2004 at 19:32.
Reason: 3rd update
|
| |
17.04.2004, 18:28
|
#14 (permalink)
| | Baby Mamber
Join Date: Apr 2004 Location: Cancun
Posts: 15
| Re: Different frontpage template Code: //$cur_template = $mainframe->getTemplate();
if ($option == "com_frontpage"){
$cur_template = "TEMPLATE_NAME";
} else {
$cur_template = $mainframe->getTemplate();
} In this example how can I do to have 3 templates in one mambo site
one for the com_frontpage
one for the com_weblinks
and the default template....
Can anybody help me...? |
| |
17.04.2004, 19:05
|
#15 (permalink)
| | Mamber
Join Date: Apr 2004 Location: Quebec City, Canada
Posts: 57
| Re: Different frontpage template Quote: |
I have been making components/modules/templates for a while now and have a number of clients running intranets and websites with Mambo.
| Richard,
I would like to invite you to set up your own project on www.mosforge.net.
Thanks, |
| |
17.04.2004, 20:35
|
#16 (permalink)
| | Mamber
Join Date: Apr 2004 Location: Dallas, TX
Posts: 71
| Re: Different frontpage template Pixocom -- replace your index.php (the one inside your template folder -- not the core file) with this: Code: <?php
defined( '_VALID_MOS' ) or die( 'Oops... Sorry, wrong page.' );
switch ($option) {
case 'com_frontpage': //show home page template
include_once ('index_front_page.php');
break;
case 'com_weblinks': //show web links template
include_once ('index_weblinks.php');
break;
default: // DEFAULT FOR ALL
include_once ('index_default.php');
break;
}
?> Then, obviously, make index_front_page.php, index_weblinks.php, index_default.php with whatever layout you like.
Everybody -- this approach is much better than hacking core, since it keeps the templating switch inside your template folder, making security patches, etc. simpler. |
| |
17.04.2004, 22:05
|
#17 (permalink)
| | Baby Mamber
Join Date: Apr 2004 Location: Cancun
Posts: 15
| Re: Different frontpage template Quote: |
Originally Posted by lazarus_bitmap Pixocom -- replace your index.php (the one inside your template folder -- not the core file) with this: Code: <?php
defined( '_VALID_MOS' ) or die( 'Oops... Sorry, wrong page.' );
switch ($option) {
case 'com_frontpage': //show home page template
include_once ('index_front_page.php');
break;
case 'com_weblinks': //show web links template
include_once ('index_weblinks.php');
break;
default: // DEFAULT FOR ALL
include_once ('index_default.php');
break;
}
?> Then, obviously, make index_front_page.php, index_weblinks.php, index_default.php with whatever layout you like.
Everybody -- this approach is much better than hacking core, since it keeps the templating switch inside your template folder, making security patches, etc. simpler. | Thanks Jerry...
I was look something code in other thread like this.. but i didnt understand.. now is perfectly clear.. and it FUNCTION VERY WELL !!
THANKS... |
| |
18.04.2004, 13:11
|
#18 (permalink)
| | Baby Mamber
Join Date: Apr 2004 Location: Lincoln UK
Posts: 7
| Re: Different frontpage template Hi, I have been following this thread and I was just wondering if this method would work if you wanted to use a different template for different pages when they are all 'typed content' rather than components.  |
| |
18.04.2004, 14:13
|
#19 (permalink)
| | Expert Mamber
Join Date: Apr 2004 Location: Melbourne
Posts: 385
| Re: Different frontpage template Yes, I believe so.
That's what I'd use anyway. 
__________________
"If you cannot win, make the one ahead of you break the record."
| Visualdensity.com |
|
| |
18.04.2004, 14:19
|
#20 (permalink)
| | Mamber
Join Date: Apr 2004 Location: Dallas, TX
Posts: 71
| Re: Different frontpage template Look at my earlier post in this thread. Where my switch statement references 'content', it changes templates for typed content pages. As I'd mentioned earlier, just replace your index.php template code with it, then call whatever subtemplates you need using it. |
| | | Thread Tools | Search this Thread | | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | |
Similar Threads | | Thread | Thread Starter | Forum | Replies | Last Post | | Template modules | TheGreek | Template Discussions | 10 | 07.04.2004 23:27 | All times are GMT +2. The time now is 13:22. | | | |