Hello Drupallers,

I have outputted a first draft of Drupal 7 phptemplate cheatsheet.
It still needs review from all of us so we can reach a fine one that can be useful for every drupaller.

Download it from here
Review, comment and advise so we can publish an effective one.

Thanks

Comments

Iztok’s picture

Great idea!

Maybe we should inluclude more general rules in it, e.g. I had troubles with printing custom menu. Here is more or less code from default tpl files, which are in general easy to find.

arthurhanlon’s picture

Brilliant! This is EXACTLY what I was after. Thanks loads!

valor’s picture

JoelAddison’s picture

I think the link got mixed up a bit. I found it at: http://batayneh.me/sites/default/files/Drupal7-theming-cheatsheet_1.pdf

Hope that helps.

Joel

valor’s picture

Yes correct
But you can always get it from http://batayneh.me/post/drupal-7-theming-cheat-sheet

-----------------
http://worchestra.com

carolynmarenger’s picture

It looks good on my initial view of it. However, it would be nice to have a version number or release date on the page, so that if we see another version online, we can compare date stamps to know which is more current and/or related to the drupal revision we are using.

Jeff Burnz’s picture

There is no $highlight variable... as I pointed out in the other thread you are using to promote this cheatsheet.

jnucreative’s picture

I just printed it out and will be referring to it often. Thanks much.

Jessie Nunez
j-Nu Creative Works
j-nu.com

readyman’s picture

Thanks very much for spending your time on this.

readyman,

jrambeck’s picture

I love it. Thanks for this great resource.

I did find an error and a typo.

To theme a custom page by Node ID you need to add 2 dashes before the ID. This seems to apply to anything theme file that contains a 3rd level specifier.
page--node-260.tpl.php (wrong)
page--node--260.tpl.php (correct)

I found the correct naming method mentioned here http://drupal.org/node/1089656

Also, a typo for your page.tpl.php example. You have a comma rather than a dot.
page,tpl.php

Ochefo’s picture

Just perfect!!!

-------------------------------------
Joseba Roldan
http://www.josebaroldan.info

Mark_L6n’s picture

Very nice, thanks!
Underneath html.tpl.php code, in the 1st row on the left, should '$header' be 'head'?

dustout’s picture

the link seems to be broken :(

valor’s picture

Doneeo’s picture

Great Work thank you !

- A new world of flexibility is opened by Drupal! -

iconify’s picture

Brilliant work. Thanks for this.

DriesP’s picture

Thanks buddy!

alltooeasy’s picture

Great Work!

Thanks for taking the time.

bzsim’s picture

You didn't address the search box. I am having an awful time moving the PHP code for the search box in my page template. I keep getting an undefined variable error.

prothero’s picture

I've carefully followed the tutorials and Readme's. I'm trying to make a Zen sub-theme using STARTERKIT. I did the name changes, etc, but when I clear caches, I get the error:
Notice: Undefined index: name in block_menu() (line 146 of /home/sbjazz/public_html/modules/block/block.module).
Notice: Undefined index: name in block_menu() (line 165 of /home/sbjazz/public_html/modules/block/block.module).
Notice: Undefined index: name in system_menu() (line 647 of /home/sbjazz/public_html/modules/system/system.module).

Status message

When I go to the appearance page, I get:
Notice: Undefined index: name in system_sort_modules_by_info_name() (line 925 of /home/sbjazz/public_html/modules/system/system.admin.inc).
Notice: Undefined index: name in system_sort_modules_by_info_name() (line 925 of /home/sbjazz/public_html/modules/system/system.admin.inc).
Notice: Undefined index: name in system_sort_modules_by_info_name() (line 925 of /home/sbjazz/public_html/modules/system/system.admin.inc).
Notice: Undefined index: name in system_sort_modules_by_info_name() (line 925 of /home/sbjazz/public_html/modules/system/system.admin.inc).
Notice: Undefined index: name in system_sort_modules_by_info_name() (line 925 of /home/sbjazz/public_html/modules/system/system.admin.inc).
Notice: Undefined index: name in system_sort_modules_by_info_name() (line 925 of /home/sbjazz/public_html/modules/system/system.admin.inc).
Notice: Undefined index: name in system_themes_page() (line 140 of /home/sbjazz/public_html/modules/system/system.admin.inc).
Notice: Undefined index: name in system_themes_page() (line 158 of /home/sbjazz/public_html/modules/system/system.admin.inc).
Notice: Undefined index: name in system_themes_page() (line 159 of /home/sbjazz/public_html/modules/system/system.admin.inc).
Notice: Undefined index: name in theme_system_themes_page() (line 2708 of /home/sbjazz/public_html/modules/system/system.admin.inc).

Somehow, the theme name isn't getting recognized, but I've done all the settings I can find.
Help! It's frustrating!

EarthEdNet

aerozeppelin’s picture

Thank you. This was useful!

jdesrig’s picture

First of all, thanks a lot, its a great cheatsheet!
Second, I am a little new with Drupal 7. But I am working on a theme (AT Commerce to be exact), and I noticed that it has a $content_attributes variable, but I don't see this on your cheatsheet. Is this a standard variable? What exactly is it?

zubair1’s picture

All the links pointing to the cheatsheet are broken, is there a working linking for it.

P.S: I think it should be stored some where on the cloud to avoid hosting issues and extend the projects live.

robhoefakker’s picture