开发者

Joomla - Multiple Layouts in one template file

开发者 https://www.devze.com 2023-04-10 02:34 出处:网络
I am starting to build a website in Joomla 1.6. The website is going to primarily have two layouts. One for the homepage and the other is for all the other sub-pages.

I am starting to build a website in Joomla 1.6. The website is going to primarily have two layouts. One for the homepage and the other is for all the other sub-pages.

The catch: I am wanting to put both the layouts in one template (or folder).

I have seen this done before by using a conditional statement with the JURI:current() function, but for some odd reason, it is not working properly for me.

Here is some basic psuedocode to indicate what I am trying to do...

<?php 

$HomePagePath = 'Homepage URL here...';
echo JURI::current(); // Just to test what the current output is going to be.
?>

<?php if(JURI::current() == $HomePagePath ): ?>

Template for homepage here

<? else; ?>

Template for sub-pages here

<? endif; ?>

When I test what I am building with this code, it is not working properly. I have ensured several times that the output from the current JURI matches the current URL in the browser. It is showing me the sub-page content rather than the homepage content... I am not sure what is causing this :/ ...

I am currently running this website without a real domain behind it. I am using the GoDaddy Preview DNS feature for the time being... This feature basically gives me a temporary domain until I point the appropriate one. I do not know if this could have something to do with the current JURI not parsing properly? This is the only thing I can think of that would be causing this...

I guess my next question is... do you know a开发者_开发知识库nother method, other than the current() function, that will accomplish what I am trying to do?

Thanks!

Chris


You can use template Styles to help in this process.

You can duplicate styles, and change things about the style - but each style will use the same 'template'.

I've played around with it a bit and I think it's probably pretty close to exactly what you're looking to do - unless you wanted a completely separate look for the 2nd template in which case using 2 templates will probably be the 'best bet'.

I'd recommend looking into template styles though - essentially you could have as many 'styles' of the template as you want, but everything is based off of that one 'template', it's only the style that's changing. You can go into your menu items and select that style from the dropdown for templates. I hope that helps to make sense, because it sounds like exactly what you're looking for.

Also, I'd recommend following the upgrade to 1.7 before you get too far along in development. Both for security reasons, and to make sure your template items work smoothly with 1.7 (they're pretty similar, but I've had some templates that didn't enjoy the jump from 1.6 -> 1.7).

*edit: here is a little information on it: Joomla Styles

0

精彩评论

暂无评论...
验证码 换一张
取 消