So I've got my site built up something like this.
{content block="intro"}
etc...........
I've got 4 pages set up, 1.Home, 2.Portfolio, 3.About me, 4. Contact.
I want to remove the div "intro" from all pages except for home. In other words is it possible to delete and add divs depending on the page without using more than one template?
Different layout per page with 1 template
Re: Different layout per page with 1 template
When editing the content on your home page, click on Options and enter the following into the "Smarty data..." field
In your template, use:
Another option would be to capture the output of the content block, and insert logic to only display it if there is any content.. This way, you can use it on any page without having to set the variable
Code: Select all
{assign var="display_info" value="1"}
Code: Select all
{if isset($display_info)}
<div id="intro">{content block="intro"}</div>
{/if}
Re: Different layout per page with 1 template
That is a great sollution thanks!
Would I be able to remove the editable area for the divs and content blocks that were removed from the page on the content->page area in the admin environment?
Would I be able to remove the editable area for the divs and content blocks that were removed from the page on the content->page area in the admin environment?
Re: Different layout per page with 1 template
I don't believe so..
I don't know why I didn't think of it before, but you can use a Global Content Block instead....
Now you won't have any extra content blocks when editing any page... If you need to edit "Info", just edit the GCB.
I don't know why I didn't think of it before, but you can use a Global Content Block instead....
Code: Select all
{if isset($display_info)}
<div id="intro">{global_content name='info'}</div>
{/if}
Re: Different layout per page with 1 template
Thanks a lot for helping! Works perfectly. 

Re: Different layout per page with 1 template
Glad I could help! I do something similar on my site.
http://teamwishbone.com
Ignore the glaring graphical issues. :( (Edit.. I fixed the glaring errors
) Compare the home page vs. the others. I made an option to have different content in the black content section for each page, each with a different polaroid pic, but never got around to doing it.
Make sure you show us your site when you're done!
http://teamwishbone.com
Ignore the glaring graphical issues. :( (Edit.. I fixed the glaring errors

Make sure you show us your site when you're done!
Last edited by Wishbone on Fri Jan 08, 2010 6:02 am, edited 1 time in total.