Page 1 of 1

Different Template File for Inner Pages

Posted: Tue Feb 26, 2008 5:25 pm
by Design ICU
Hello. First post here. I'm an experienced designer and Web standards coder working on my first Joomla! project.

I've followed the instructions for setting up a template and so far so good. However, I actually have two page designs for the site I'm working on: one for the home page and one for the inner pages. (The header is slightly different on each.)

I can't find instructions on-line for getting Joomla to use one template file for the home page and another file for all other pages. Any help appreciated. URLs to appropriate pages would be great.

Thanks in advance,

Sean

Re: Different Template File for Inner Pages

Posted: Wed Feb 27, 2008 4:06 pm
by fastnet
Hi Sean

When logged in, trying the following:

From the top menu click: site > template manager > site templates

This is where your templates are and you can choose to change to another default one.

Here, you can also click another templates radio button (leaving your homepage as default) then click 'Assign' (top right) - and choose which sub level pages this other template is used instead of your default homepage template.

Hope this helps...

cheers
fastnet

Re: Different Template File for Inner Pages

Posted: Thu Mar 06, 2008 5:20 am
by Design ICU
Thanks, fastnet, that was really helpful. It gets me 80% there.

I've assigned my INNER PAGE template to all inner pages, just as you described. However, for stories listed on the home page—when you click those and are brought to their dynamically generated page, I'm still getting the HOME PAGE template.

I think the problem is that only pages with menu items show up in that screen, and these news stories will not have menu items. Is there a way to assign my INNER PAGE template to stories like this, by category perhaps...

Thanks again,

Sean

Re: Different Template File for Inner Pages

Posted: Wed Mar 12, 2008 6:29 pm
by Design ICU
So I have narrowed this down. Here's an example of what I'm talking about...

A news article is available from two places on the site...

1) It's listed on the home page so you can click the headline there to read the full story;

2) It's listed in (section) MAGAZINE and in (category) News so if you go to the news page, you can also click on the headline there to read the full story.

I have five templates running on the site: one template for the home page and one template per each of four main sections: MAGAZINE, FOR SALE, REGISTER, and MORE.

My dilemma is that depending on how you get to the story (i.e. depending on which of those two links you click) a different template is applied to the story.

If you get to the story by clicking the link on the home page, the story is displayed using the home page template. Whereas, if you get to the story by clicking the link on the MAGAZINE>NEWS page the story is displayed using the magazine section template.

So even though the story is listed under MAGAZINE>NEWS it does not automatically take on the MAGAZINE template. This seems really stupid to me. It should display using the template for the category to which it's been assigned—or there should be an option when editing the content item that allows me to pick which template it should use to display.

Is there a way to achieve this in Joomla 1.0?

Re: Different Template File for Inner Pages

Posted: Tue Mar 18, 2008 5:34 pm
by Design ICU
bump — no takers?

Re: Different Template File for Inner Pages

Posted: Tue Jun 03, 2008 5:56 pm
by madelman2
have you found any solution to this?

Re: Different Template File for Inner Pages

Posted: Wed Jun 04, 2008 7:02 pm
by Design ICU
No solution in Joomla so what I'm doing is checking the URL with some PHP in the master template. If it's such-and-such I show one header, if it's anything else I show another header. Here's the code...

Code: Select all

// grab page url
function curPageURL() {
	$pageURL = 'http';
	if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
	$pageURL .= "://";
	if ($_SERVER["SERVER_PORT"] != "80") {
	$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
		} else {
		$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
		}
	return $pageURL;
}

// check URL for header switching
$check4home = 0;
$checkURL = curPageURL();
if (strcmp($checkURL,'http://www.afloat.ie/afloat/index.php?option=com_frontpage&Itemid=1') == 0) {$check4home = 1;}
elseif (strcmp($checkURL,'http://afloat.ie/afloat/index.php?option=com_frontpage&Itemid=1') == 0) {$check4home = 1;}
elseif (strcmp($checkURL,'http://www.afloat.ie/afloat/index.php') == 0) {$check4home = 1;}
elseif (strcmp($checkURL,'http://afloat.ie/afloat/index.php') == 0) {$check4home = 1;}
elseif (strcmp($checkURL,'http://www.afloat.ie/afloat/') == 0) {$check4home = 1;}
elseif (strcmp($checkURL,'http://afloat.ie/afloat/') == 0) {$check4home = 1;}
else {$check4home = 0;}
And then the actual switching...

Code: Select all

if ($check4home == 1) {echo 'HEADER 1 HTML GOES HERE';} else {echo 'HEADER 2 HTML GOES HERE';}
This works for this site because the only difference between the home page design and the inner page design is the header. But it's a cumbersome solution that wouldn't work for all sites.

Re: Different Template File for Inner Pages

Posted: Tue May 21, 2013 1:44 pm
by shenpika
Hello I know you post this long time ago, did you get the solution for this , if you have can you let me know ? please :)