Is it possible to place the content of the same content block twice in a template?
I'm developing a mobile site for a client and want to re-use as much as possible.
Some pages use the GBFilepicker module to add an image for the page. I would like to show that image in the mobile site and the normal site.
Because I divide my code using {mobiledetect} and an if else statement the content for the page is separated, therefor I like the call the same custom content block twice. Any possibilities?
[Solved]Use custom content block twice?
[Solved]Use custom content block twice?
Last edited by vinyl on Fri Nov 29, 2013 9:10 pm, edited 1 time in total.
Re: Use custom content block twice?
Code: Select all
....
{* Assign the main Content block to a string *}
{content assign='maincontent' label='My content block'}
{* Create a second content block! *}
{content block='second_content' assign='second_content' label='My second content block'}
........
<div id="content">
<h2>{title}</h2> <!-- Title of the page -->
{$maincontent} <!-- Page content from string -->
{if $second_content} <!-- Only show second content block when it has some content -->
<h3>Second Content Block</h3>
{$second_content}
{/if}
</div>
............
{if $second_content} <!-- Only show second content block when it has some content -->
<h3>Second Content Block</h3>
{$second_content}
{/if}
.......
etc...
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Re: Use custom content block twice?
Great! Thanks for this solution. I knew it was possible, just couldn't find how..
Re: Use custom content block twice?
Glad I could help. Would you please add [Solved] to the beginning of the subject title?
Thanks
Thanks

"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!