By scarecrow-rye on
After diving to the world of Drupal and following Lullabot's excellent "How To Build Flickr In Drupal" (I'm still having trouble getting the views to work correctly though) I am now altering the custom node-image.tpl.php file. My only stumbling block is not knowing the full list of variables that are avaliable to me. Can anyone help?
I simply want to print the code for a thumbnail image, but echo $content gives me the photos AND textual content. Can I print just the image?
And is there any method to print all avaliable variables, or even some documentation listing the variables I have access to?
Thanks in advance.
Comments
Some suggestions
Did you take a look at the following book page :
http://drupal.org/node/11816
It gives the list of available variables in template.
If it doesn't help and you don't find any other solution, you can do it the "brute" way :
Thank You
Thank you! This is just the type of thing I was looking for.
While I can see the advantages of pre-compiling certain parts of the template - so that
echo $picture;will quickly and easily print<div class="picture"><a href="/user/1" title="View user profile."><img src="http://www.mydomain/files/pictures/picture-1.jpg" alt="User's picture" title="User's picture" /></a></div>, it would seem strange that I cannot have more control over the code without resorting to string manipulation.A Solution?
I have just stumbled across the Contemplate module - http://drupal.org/project/contemplate - which sounds like it will allow me more control over the final output of my code, but it still seems strange to need an additional module to access node variables. Oh well.
Accessing node variables
You can do this with something like :
$node=node_load($nid);.$node=node_prepare($node);will allow you to generate the filtered content.Thanks
Thanks for that. I shall look them up in the API and try them out.
Variables
After experimenting, I have discovered that I can access node variables in the following way...
subscribing
subscribing
http://SocialNicheGuru.com
Delivering inSITE(TM), we empower you to deliver the right product and the right message to the right NICHE at the right time across all product, marketing, and sales channels.
or
What about human readable version of node type?
I know you can easily use $node->type variable but this is the machine version. I'd like to print the human readable version of node-type wich sometimes contains caps, spaces and other symbols. Any idea or suggestion?