Functional FIPS: Learning PHP for Drupal Theming - Presentation Transcript
Functional FIPS
PHP for Drupal Designers and Themers
www.hicktech.com
@emmajanedotnet
About this talk
●
There are a lot of theme snippets available in the Theme Guide. There
is not, however, a lot of information about PHP which is the language
that makes up these snippets. If you're tired of copying, pasting and
praying and are ready to understand some of the magic behind those
snippets, this session is for you!
●
In this session you will learn how to manipulate and master:
●
The very, very basics of PHP and the popular theming engine
PHPtemplate
●
Variables and tpl.php template files
●
Arrays and objects and other crowbarworthy data containers.
●
The really scary looking stuff that's in the mysterious file
template.php
●
Examples will be pulled from the Drupal.org Theme Guide as well as
the wildly successful book on theming, Front End Drupal (coauthored
by Emma Jane and Konstantin Kaefer).
Stick around, I've got copies to give away.
Drupal Theme Guide
http://drupal.org/themeguide
Theme snippets
http://drupal.org/node/45471
Learning through analogies
www.travelinghoedowners.com
bootstrapping
Variables
http://www.jontwest.com/ProBono.php
Variables
Contents of variables
exist inside their containers
Contents of variables
exist inside their containers
http://www.laboutiquedupetitprince.com/en/figures56/pixi81/pixifigurethelittle
princesheepbox518.html
PHPtemplate
Decide on the dance
Choose your clothes Dance the dance
http://www.kodakgallery.com/Slideshow.jsp?mode=fromshare&Uc=6m9np57.9mj7q0yf&Uy=ripni&Ux=0
PHPtemplate
Collect the content from
Drupal using modules Run through the Print the variables
Drupal theme in your template
functions & your files
custom theme layer
http://www.kodakgallery.com/Slideshow.jsp?mode=fromshare&Uc=6m9np57.9mj7q0yf&Uy=ripni&Ux=0
How to create themes
1.Download an existing theme.
2.Look for variables and functions.
3.Alter the placement of the “printed” things.
4.Save and upload the theme files.
5.Clear the theme registry (Drupal admin).
6.Enjoy your new theme.
Conditionals
if (you're the inside couple) {
go clockwise
}
} else {
go counter clockwise.
}
http://www.dehnbase.org/sd/tutorial/counterrotate.php?p=4
What's an “if”?
if ($logo) {
<?php print ?>
}
Fancy data structures: arrays + objects
Grouping and sorting your data
Fancy data structures: arrays
Multiple “drawers” of sorted content
Multiple values stored in one array
“Advanced” PHP
●
Never be afraid to try something.
●
Always back up your files first.
●
Take a LOT of notes.
●
Be bold! And be brave!
template.php: what's up with that?
●
Preparing variables that weren't assembled by
Drupal and its modules.
●
Altering the contents of variables that were
prepared by Drupal and its modules.
●
Special theming functions to do fun things like
'edit this block' links and random images.
●
Read the Zen base theme documentation and
template.php file.
Using template.php
Collect the content from
Drupal using modules Create new Print the variables
and run it through the information to feed in your template
default theme functions to your theme files
provided by Drupal.
http://www.kodakgallery.com/Slideshow.jsp?mode=fromshare&Uc=6m9np57.9mj7q0yf&Uy=ripni&Ux=0
Summarizing PHP for Designers
●
PHP is a linear “programming” language,
just like a dance.
●
PHP stores information in variables.
●
Sometimes variables hold lots of information
in special variables called “arrays.”
●
Drupal has lots of magic variables that are
loaded with content. Check out:
http://drupal.org/themeguide
Conditionals
if (you're the inside couple) {
go clockwise
}
} else {
go counter clockwise.
}
http://www.dehnbase.org/sd/tutorial/counterrotate.php?p=4
Ready to rope
yourself a
theme?
@emmajanedotnet
www.hicktech.com < theming classes
Front End Drupal < theming book
http://www.flickr.com/photos/fkehren/3352577815/
0 comments
Post a comment