Based on what I could find e.g. here in the forum (viewtopic.php?t=72290), I would expect something like this to work: {$fields.description_{$lang}.value} - however, when I try to use a construct like that in my Gallery-template, I'm getting an "OOOPS" with the error 'Unexpected "{", expected one of: "}"'. I'm probably missing something obvious - anyone who can point out the error in my ways?
Dynamic variable in Gallery-template? Topic is solved
							
						Dynamic variable in Gallery-template?
		
													
							
						
			
			
			
			
			In my Gallery-galleries, I am using thee custom fields "description_en", "description_de" and "description_nl" to be able to have language-specific descriptions. Now I'm trying to deal with these in the Gallery-template "automatically" (i.e. dependent on a global $lang variable).
Based on what I could find e.g. here in the forum (viewtopic.php?t=72290), I would expect something like this to work: {$fields.description_{$lang}.value} - however, when I try to use a construct like that in my Gallery-template, I'm getting an "OOOPS" with the error 'Unexpected "{", expected one of: "}"'. I'm probably missing something obvious - anyone who can point out the error in my ways?
			
			
									
						
										
						Based on what I could find e.g. here in the forum (viewtopic.php?t=72290), I would expect something like this to work: {$fields.description_{$lang}.value} - however, when I try to use a construct like that in my Gallery-template, I'm getting an "OOOPS" with the error 'Unexpected "{", expected one of: "}"'. I'm probably missing something obvious - anyone who can point out the error in my ways?
Re: Dynamic variable in Gallery-template?
There might be a better way, but I'd try:
(not tested)
			
			
									
						
							Code: Select all
{$tmp="description_{$lang}"}
{$fields.$tmp.value}Not getting the answer you need? CMSMS support options
			
						Re: Dynamic variable in Gallery-template?
Thank you! I think you found the one combination I had not thought off...  
  This does indeed work, which means that I can strike another step off my list. Nice!
BTW: I did try the original syntax as described in my first post in ordinary page templates and even on pages themselves, and there, this approach does work. Hence, I assume that it is actually correct Smarty-syntax, but that the way the templates are interpreted in Gallery somehow interferes with it...
			
			
									
						
										
						BTW: I did try the original syntax as described in my first post in ordinary page templates and even on pages themselves, and there, this approach does work. Hence, I assume that it is actually correct Smarty-syntax, but that the way the templates are interpreted in Gallery somehow interferes with it...
Re: Dynamic variable in Gallery-template?
It's possible they needed an {eval}, depends how or if the template is parsed through Smarty, or when it happens.
			
			
									
						
							Not getting the answer you need? CMSMS support options
			
						

