Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
The following code shows a random link:

3b67143fb916c633aa8a176e8c28458f_gallery1?p=116

instead of

meldungen.php?p=108

Doesn't mosaic recognize k_page_link or is it a different scope?

Code: Select all
<cms:pages masterpage='news.php'>
<cms:show_mosaic 'preview'>
<cms:if k_tile_name='gallery'>
<cms:show k_page_link />
</cms:if>
</cms:show_mosaic>
</cms:pages>
Ich solved it with a variable, but it feels a little bit weird.

Code: Select all
<cms:pages masterpage='news.php'>
  <cms:set news_link=k_page_link />
  <cms:show_mosaic 'preview'>
    <cms:if k_tile_name='gallery'>
      <cms:show news_link />
    </cms:if>
  </cms:show_mosaic>
</cms:pages>
Tiles are internally the same as other pages - so when <cms:show_mosaic> lists them, one of the variables brought into context is 'k_page_link' which points to the 'tile' being iterated (and this overrides the 'k_page_link' of any outer tag e.g. <cms:pages> in your case). I think that should explain what you have been experiencing.

To reference a variable from an outer context, placing it into another variable is the right thing to do.
So, your solution, is actually the correct thing to do.
3 posts Page 1 of 1