[themes] Autogenerated Lists

Miles Rout miles.rout at gmail.com
Fri Aug 13 21:55:48 UTC 2010


Thanks, so that means that using theme functions will format your links,
etc., if someone has written a function for that? How do you override that?
When you're naming the function in the template.php file, do you write
nameofmytheme_links or do you just write theme_links? Because when you
install modules etc. it warns me that I can't have two functions named the
same, which makes me tend to thing that it would be the first option...

Sorry if that doesn't make sense.

On Tue, Aug 10, 2010 at 9:32 PM, Peter Anderson <list at panda.id.au> wrote:

>  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
>
>
> _______________________________________________
> themes mailing list
> themes at drupal.org
> http://lists.drupal.org/mailman/listinfo/themes
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/themes/attachments/20100814/a752b0ee/attachment.html 


More information about the themes mailing list