Home Tutorials Template files

Template files

  previous next
February 11, 2009 by Victor    

Thus, we need to create some template files under /tmpl, let’s start with the default.php:

<p>
   <?php print $link[0] ?> 
</p>
<a href="<?php print $link[2] ?>"><?php print $link[1] ?></a>

Much better. Ooops, it’s not for sure that there is going to be a pretext, no nifty to leave empty tags hanging around. So, if there is a pretext ...

<?php if ($link[0]) : ?>
   <p>
      <?php print $link[0] ?>
   </p>
<?php endif; ?>
<a href="<?php print $link[2] ?>"><?php print $link[1] ?></a>

You‘ll get used to this syntax, I admit, it is strange and addictive. We have forgotten the class suffix thing, haven’t we?

<?php if ($link[0]) : ?>
<p class="ranlatest<?php echo $params->get('stylesfx'); ?>">
   <?php print $link[0] ?> 
</p>
<?php endif; ?>
<a class="ranlatest<?php echo $params->get('stylesfx'); ?>"
    href="<?php print $link[2] ?>"><?php print $link[1] ?></a>

Is this better than the other one? Hmm, kind of, this is why I like div tags. Anyway, just to mention here that you could also use $params->get('pretext') instead of passing it through the link array. Having just the default.php template is absolutely fine however take it to the end.

Add comment


Security code
Refresh