[Solved] Passing a string to a module template

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Cerulean
Forum Members
Forum Members
Posts: 172
Joined: Mon Nov 01, 2010 8:56 am

[Solved] Passing a string to a module template

Post by Cerulean »

For modules that have their own template system (e.g. News, ListIt2, Gallery), is it possible to pass a string from my page template to the module so that it is available in the module template? I'm imagining something like a custom parameter for the module when it is called in the page template.

Using Gallery as an example...

Code: Select all

{Gallery my_custom_width="200"}
...so that in my Gallery template I can do this...

Code: Select all

{foreach from=$images item=image}
<img src="{$image->file}" width="{$my_custom_width}">
{/foreach}
Of course I tried this to check it and it seems like custom parameters in module tags generate an error. Is there another way?
Last edited by Cerulean on Fri Jan 17, 2014 6:36 am, edited 1 time in total.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Passing a string to a module template

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Cerulean
Forum Members
Forum Members
Posts: 172
Joined: Mon Nov 01, 2010 8:56 am

[Solved] Re: Passing a string to a module template

Post by Cerulean »

Thanks, works great.
Post Reply

Return to “Modules/Add-Ons”