[development] .tpl-ifying Drupal

Dries Buytaert dries.buytaert at gmail.com
Mon May 7 10:11:16 UTC 2007


On 04 May 2007, at 20:09, Earl Miles wrote:
> I completely agree. The primary thing to look at when converting a  
> theme function to a template is how often this theme function gets  
> used on a page. If it's a lot, then absolutely that function should  
> not be converted. Some obvious candidates to NOT convert are  
> theme_placeholder() and theme_username(). Making these functions  
> into templates don't buy us much anyway.
>
> It's definitely a case of 'start with the big ones' and work to the  
> small ones. Big ones are often used only occasionally per page;  
> small ones might be used a lot.

Yep, we'll only want to convert those theme_ functions that are often  
themed.

Here is a useful bash one-liner that you can run from contributions/ 
themes:

contributions/themes dries$  for FILE in `find . -name *.tpl.php`; do  
echo $FILE | awk -F/ '{print $NF}'; done | sort | uniq -c | sort -rn  
| head -n 25

This command will compile a list of the top-25 most popular template  
files.  The first column denotes how many different contributed  
themes ship or use that template file.

159 page.tpl.php
150 node.tpl.php
119 comment.tpl.php
103 block.tpl.php
   81 box.tpl.php
   14 search-box.tpl.php
    4 node-forum.tpl.php
    3 page-admin.tpl.php
    3 image_gallery.tpl.php
    2 style.tpl.php
    2 search_block_form.tpl.php
    2 search-theme-form.tpl.php
    2 block-sidebar.tpl.php
    2 block-custom.tpl.php
    1 page_admin.tpl.php
    1 page-front.tpl.php
    1 node-weblink.tpl.php
    1 node-story.tpl.php
    1 menu_item.tpl.php
    1 maintenance_page.tpl.php
    1 main.tpl.php
    1 links.tpl.php
    1 header.tpl.php
    1 comment_wrapper.tpl.php
    1 comment_controls.tpl.php
    ...

Unfortunately, this distribution isn't all that interesting ...

--
Dries Buytaert  ::  http://www.buytaert.net/



More information about the development mailing list