Page 1 of 1

Workshop: M&C Module Factory: template code examples

Posted: Wed Sep 15, 2010 9:50 am
by sanderhartveld
Hi Jean-Christophe,
Could you please post some template code examples for using module extender objects.
Thanks, Sander

Re: Workshop: M&C Module Factory: template code examples

Posted: Wed Sep 15, 2010 10:02 am
by totophe
First shot :-)

Display_details template example with ModuleXtender calls:

Code: Select all

<h1>{$item->title}</h1>
<a href="{Tasks parent_item=$item->id action="geturl" urlaction="default"}">Tasks</a>

{foreach from=$item->xtended_felist->images item=entry}
<a href="{$entry->url}" target="_new">
<img src="{$entry->resized_images.medium}" />
</a>
{/foreach}


{foreach from=$item->xtended_felist->documents item=entry}
<li><a href="{$entry->url}" target="_new">
{if $entry->title ne ''}{$entry->title}{else}{$entry->filename}{/if}
</a></li>
{/foreach}

<pre>
{$item->xtended_felist|var_dump}
</pre>
Calling ModuleXtender with Page or Category filters:

Code: Select all

{Projects currentpage=1}
or
{Projects options=2}

Re: Workshop: M&C Module Factory: template code examples

Posted: Fri Sep 17, 2010 2:59 pm
by totophe
Show sub modules:

create a filter "parent_item" on the field parent_item

Then inside the parent module template, call:

Code: Select all

{NewsletterSubarticles parent_item=$item->getId()}

Re: Workshop: M&C Module Factory: template code examples

Posted: Tue Sep 21, 2010 8:23 am
by totophe
For information, the latest version of MC Factory automatically generate those smarty templates so you can play with it.

Re: Workshop: M&C Module Factory: template code examples

Posted: Tue Sep 21, 2010 3:05 pm
by jack4ya
Thanks!  :D

Re: Workshop: M&C Module Factory: template code examples

Posted: Sun Jul 03, 2011 12:59 pm
by vinyl
I know it's an old topic but I would like to ask an additional question.

I made a module with some fields to add media. One of them is a dropdown for category. Is there a way to call the module so I can only show content in the category chosen with the dropdown?

Like {my_module category="value"} ?