Problem with $linkslist in Template

Hi,
have a problem creating a template showing a list of links.
Specifically the global variable $linkslist seems always to be empty.

At the moment this is the template i am using :


[{if !empty($linkslist)}]
<h3 class="bx_ttl">Links</h3>
<div class="bx_txt">
  [{assign var="isFirst" value=true}]
  [{foreach from=$linkslist item=link }]
    [{if !$isFirst}]
      <br /><div class="dottedline" style="background-image: url([{$shop->imagedir}]/linedot.gif)"></div><br />
    [{else}]
      [{assign var="isFirst" value=false}]
    [{/if}]
    [{ $link->oxlinks__oxinsert->value|date_format:"%d.%m.%Y" }] - <a href="[{ $link->oxlinks__oxurl->value }]" target="_new" class="links_link">[{ $link->oxlinks__oxurl->value }]</a><br /><br />
    [{ $link->oxlinks__oxurldesc->value }]
  [{ /foreach }]
</div>
[{/if}]

sadly the documentation is of no help here, maybe anyone has an idea where i made a mistake. help would be much appreciated.

Thanks in advance !

Ps. I tryied getting the size of $linkslist via {$linkslist|@count} but it´s always 0. enven tough i have some links in the shop.
The oxid Version used is 3EE.

Hello Corax,

I assume you know that every out/<my-template-name>/<view-name>.tpl file needs to have an associated views/<view-name>.php file ?

The PHP file is responsible for preparing the data and creating the variables for the tpl file. For example in views/links.php, the function render() adds linkslist to the view data. The call to parent::render() adds the rest of the default view data.

In this PHP file, You can also see the $_sThisTemplate = 'links.tpl" statement, which connects this view file to the associated links.tpl template file

If you need linkslist in the view data of a different template, you will need to copy the code from links.php to your <view-name>.php file, of if you wish to extend an existing view, you will need to write a small module to do this.

Regards

CPJ