I want to replace the value of the content block "myvalue" by a variable. Is that possible?
I tried something like this:
{assign var="i" value="1"}
{assign var="blockname" value="movie_{$i}"}
{content block="$blockname" assign="movie_$i" oneline="true"}
But "$blockname", {$blockname} or "`$blockname`" does not give the desired result.
I want to use this code in a while-loop to get a next content block if the last one is filled with content
replace content block value by a smarty variable?
Re: replace content block value by a smarty variable?
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: replace content block value by a smarty variable?
I'm not sure you can do it that way at all: I think that Content Blocks need to be defined and not a result of template logic... , but besides that the syntax is wrong...Manuzzi wrote:I want to use this code in a while-loop to get a next content block if the last one is filled with content
Maybe, if at all possible, this could work...
Code: Select all
{assign var="i" value="1"}
{assign var="blockname" value="movie_{$i}"}
{content block=$blockname assign="movie_`$i`" oneline="true"}
"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!
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: replace content block value by a smarty variable?
wont work. Content blocks have to be defined as a NAME in the template. Because the block name is used in the database.
if you want numerous blocks in a template, you will need to write a module that takes advantage of some of the advanced functions of the module API.
if you want numerous blocks in a template, you will need to write a module that takes advantage of some of the advanced functions of the module API.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: replace content block value by a smarty variable?
Thank you all for the replies.
I will leave the idea and just get back to my original setup defining a fixed amount of content blocks.
I will leave the idea and just get back to my original setup defining a fixed amount of content blocks.