my code for one of my content templates works: http://drupalbin.com/4014
but it is terrible!

I reuse sections and just copy and paste them. is there a way to define a function and then reuse it... like for printing out the leader address, phone and email... that code gets done 4 times!

And the html output is non-css-able (is that even a word?) if you could, make some suggestions how I could change the code in a few places, or suggest a post or tutorial, I would very much appreciate it!

... and I'm not sure why, but the lid's are missing, and the 'view' for the user's are missing too (I looked with print_r().) And sometimes I had to access with ...['uid'] and sometimes with ...->uid

I'm perplexed, but happy the code works.

Comments

jrglasgow’s picture

there is no reason that I know of why you shouldn't be able to create functions inside the template. contemplate just calls the php eval function.

as for non css-able code... there is no reason that you couldn't use css on the code returned in your templates, just make sure you give your html elements css IDs and Classes.

yesct’s picture

thanks! After I clean it up, I'll post back. :)