[development] PHPTemplate theme & usability

Khalid B kb at 2bits.com
Wed Sep 6 15:17:52 UTC 2006

On 9/6/06, Stefan Nagtegaal <Drupal-Devel at istyledthis.nl> wrote:
> I'm not sure I posted this to the right list, but you guys should
> forgive me when I'm on the wrong track..

Ccing this to theme list.

> As you (probably) know, I'm designing/coding a new theme. I am using
> PHPTemplate for the first time in my life to create a full theme
> (please don't ask why).
> Now, on my road to get this darn theme working I noticed that the
> following code is used inside coore themes to place the primary/
> secondary navigation:
>        <?php if (isset($secondary_links)) { ?><?php print theme
> ('links', $secondary_links, array('class' =>'links', 'id' =>
> 'subnavlist')) ?><?php } ?>
> and:
>        <?php if (isset($primary_links)) { ?><?php print theme
> ('links', $primary_links, array('class' =>'links', 'id' =>
> 'navlist')) ?><?php } ?>
> Now, my question is why do we do this?
> There is a block generated for every new 'menu list' which can be
> positioned into every region a theme supports. This is imo very weird..
> Even weirder is the way before you get the links to display into the
> defined place using the method above.
> (Goto 'admin/build/menu/settings', set the 'Menu containing (primary|
> secondary) links'). I thought we had the blocks generated for that?
> I was totally confused.. it took me 2 hours to spit through
> PHPTemplate to find a bug, another hour to fid some settings which
> would popup this idea on my mind, and 2 minutes in #drupal to get the
> solution..
> I hope you guys don't mind me saying this, but as someone who has
> been using drupal for 4 years now, this does not make any sense to me
> at all..
> is this only me?
> Is there anyone who could think of a way on how we can improve this?
> Or am I all wrong, and is this usable "as is"?

You don't need to use the block to display the primary and secondary

You can use something as simple as:
   <ul id="primary">
    <?php foreach (array_reverse($primary_links) as $link): ?>
     <li><?php print $link; ?></li>
    <?php endforeach; ?>

   <div id="secondary">
    <?php print is_array($secondary_links) ? theme('links',
$secondary_links) : "" ?>

Or for a more complex way, see:

More than one way to do things, and I like it this way ...

More information about the development mailing list