Hi there,
I'm trying to set up a "print page" link on my site, and the {print} tag will not work for me for several reasons. (I use Textile formatting in my main content block, there are additional custom content blocks, etc.)
It seems like the easiest thing to do would be to create a template that strips out the menu and other elements, but lets me style the other things how I want, and use {cms_selflink} to link to that using some parameter that forces the specific template. But for the life of me I can't find anything in the documentation that shows how to do that. Can anyone help? Thanks!
Link parameter to set different template?
Re: Link parameter to set different template?
You could use an additional get variable in the url and then use smarty to vary the output in your main template. For example:
Then in the template:
Hope this helps!
Code: Select all
www.yoursite.co.uk/page?printable=true
Code: Select all
{if $smarty.get.printable}
print only stuff
{else}
normal stuff
{/if}
Green Sheep Design Ltd. - www.greensheep.co.uk
Re: Link parameter to set different template?
Thanks, I'll try that!
However, I'm still curious: is there not a way to serve content in a different template based on the results of an {if} statement or Javascript check? That would be helpful for my printing issue, but also for serving a touch-optimized site to mobile devices, etc.
However, I'm still curious: is there not a way to serve content in a different template based on the results of an {if} statement or Javascript check? That would be helpful for my printing issue, but also for serving a touch-optimized site to mobile devices, etc.
Re: Link parameter to set different template?
As far as I'm aware it's not possible. However, there are other means like alternative stylesheets (using media="print, handheld, etc").
Also, you could create multiple content blocks in your template ({content block="block1, block2, etc"}) and show different content that way. I always use the AdvancedContent module to do this sort of thing because it gives tons more options on the editing side - you can even use things like checkboxes which are a great feature.
More recently, I've managed to create some sites with a single template and then allow users to turn on/off sideboxes or switch layouts when editing the content. I don't think it would be too difficult to have a UDT to detect a mobile browser and serve up different content in a similar way.
Also, you could create multiple content blocks in your template ({content block="block1, block2, etc"}) and show different content that way. I always use the AdvancedContent module to do this sort of thing because it gives tons more options on the editing side - you can even use things like checkboxes which are a great feature.
More recently, I've managed to create some sites with a single template and then allow users to turn on/off sideboxes or switch layouts when editing the content. I don't think it would be too difficult to have a UDT to detect a mobile browser and serve up different content in a similar way.
Green Sheep Design Ltd. - www.greensheep.co.uk