Toms King
|
Tuesday 29 August 2006 4:14:43 am
On a template, I wanna to catch the value of $p, so I define at the begining
{if eq($p,'')}
{ set $p = 1 }
Testing
{/if}
for if cannot catch $p, $p will be set the default value as 1, and print Testing and when I run the template, testing was printed, but the value of $p haven't been set, why?..... and when I add some code as
{if eq($p,'')}
{ set $p = 1 }
Testing
{/if}
{if eq($p,'')}
Testing2
{/if}
only Testing 2 was print, so strange the full code of this template is attached
{if eq($p,'')}
{ set $p = 1 }
Testing
{/if}
{if eq($p,'')}
Testing2
{/if}
{let news=fetch(content,list,hash(parent_node_id,73,
limit, 10,
sort_by, array( published, false() ),
offset,$view_parameters.offset,
class_filter_type,include,
class_filter_array,array('17')))
$pages = ceil(div(count($news),3))
}
Pages: <
{for 1 to $pages as $page}
<a href={concat('content/news_display?p=',$page)|ezurl()}>{$page}</a>
{/for} > Page: {$p} </br>
{if ge(count($news),mul($pages,3))}
{for sub(mul($p,3),3) to sub(mul($p,3),1) as $index}
<a href={$news[$index].url_alias|ezurl}> {$news[$index].object.data_map.title.content|wash} </a></br>
{$news[$index].object.data_map.intro.content|wash} </br></br>
{/for}
{else}
{for sub(mul($p,3),3) to sub(count($news),1) as $index}
<a href={$news[$index].url_alias|ezurl}> {$news[$index].object.data_map.title.content|wash} </a></br>
{$news[$index].object.data_map.intro.content|wash} </br></br>
{/for}
{/if}
|