[themes] Autogenerated Lists
Peter Anderson
list at panda.id.au
Tue Aug 10 09:32:38 UTC 2010
Hi Miles,
The theme() function outputs code in a way that allows users to override
it if necessary. To see how any theme() function works, look it up on
http://api.drupal.org (making the first parameter part of the function
name).
For example: theme('links', ...) would become theme_links():
http://api.drupal.org/api/function/theme_links/6
And theme('image', ...) would become theme_image():
http://api.drupal.org/api/function/theme_image/6
The primary and secondary links are output via a theme function as
they're placed into an unordered list (see the code at the above URL).
This makes it easy to output the primary or secondary links anywhere in
your page template without having to re-write the unordered list each
time; but you can always override the theme function in your
template.php file if you want to change the unordered list to something
else.
Variables such as $page_title aren't output via a theme function as
they're just that; variables. They don't have any formatting associated
with them, so you have to format them yourself in page.tpl.php, like
putting them in H1 tags or whatever.
Hope that helps explain it a bit.
On 10/08/10 19:15, Miles Rout wrote:
> Hi.
>
> I am Miles Rout, and I'm currently converting a static HTML theme to a
> drupal theme. I've been wondering about the use of:
>
> <?php print theme('links', $primary_links, array('class' => 'links
> primary-links')) ?> and <?php print theme('links', $secondary_links,
> array('class' => 'links secondary-links')) ?>
>
> When I use these, should I need to change my CSS? Do they output the
> list in a funny way? Why is this using a theme(); function when they
> could just be <?php print $primary_links ?> or something like that? Or
> alternatively, why isn't the page_title something like <?php print
> theme('title', $page_title, array('class' => 'title page-title')) ?> ?
>
> Thanks,
> Miles
--
Kind regards,
Peter Anderson.
http://panda.id.au
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/themes/attachments/20100810/ef318875/attachment.html
More information about the themes
mailing list