Page 1 of 1

Gallery ul li

Posted: Fri Nov 06, 2015 10:56 pm
by Brandt
Hello beautiful people,

I have a question regarding the Gallery Module. I have the following template:

Code: Select all

<ul>
{assign var='g_prevdepth' value=1}
{foreach from=$images item=image name=img}

{if $image->depth > $g_prevdepth}
{repeat string="<ul>" times=$image->depth-$g_prevdepth}
{elseif $image->depth < $g_prevdepth}
{repeat string="</li></ul>" times=$g_prevdepth-$image->depth}
</li>
{elseif $smarty.foreach.img.index > 0}</li>
{/if}

<li>{$gallerydate}
<a href="{$image->file}" title="{$image->titlename}"><img src="{$image->thumb|escape:'url'|replace:'%2F':'/'|replace:'thumb_':''}" alt="{$image->titlename}" /></a>
<a href="{$image->file}" title="{$image->titlename}">Klik om te lezen</a>
{$image->comment}

{assign var='g_prevdepth' value=$image->depth}
{/foreach}
{repeat string="</li></ul>" times=$image->depth-1}</li>
</ul>
Which prints this structure:

Code: Select all

<ul></ul>
<li><a></a></li>
<li><a></a></li>
But what I would like, offcoarse, is following:

Code: Select all

<ul>
<li><a></a></li>
<li><a></a></li>
</ul>
But I don't understand where it is going wrong in the template code…

Joep

Re: Gallery ul li

Posted: Fri Nov 06, 2015 11:05 pm
by Brandt
I did the following which printed the proper structure:

Code: Select all

<ul>
{foreach from=$images item=image name=img}

<li>
{$gallerydate}
<a href="{$image->file}" title="{$image->titlename}"><img src="{$image->thumb|escape:'url'|replace:'%2F':'/'|replace:'thumb_':''}" alt="{$image->titlename}" /></a>
<a href="{$image->file}" title="{$image->titlename}">Klik om te lezen</a>
{$image->comment}
</li>

{assign var='g_prevdepth' value=$image->depth}
{/foreach}
</ul>
As you can see I deleted a bunch of code, this is the part which I understand and it works, but I don't know what I deleted…

Anybody any idea?