I am curious what php variables are available within a node. I want to be able to use $base_path from within a node. Any ideas?

Comments

WorldFallz’s picture

see Node.tpl.php (assuming you use the phptemplate engine)

jondkoon’s picture

I actually meant the individual nodes in a page. On my home page for example. If I click "Edit" and then use php input format what variables do I have access to within there?

WorldFallz’s picture

I don't believe they are available there without doing something like this (to load the node object, you could use user_load for users, and project_load for profile, etc):

if ( arg(0) == 'node' && is_numeric(arg(1)) && ! arg(2) ) {
  $node = node_load(arg(1));
  print format_date($node->created);
}

I'm not sure how to get the $base_url...

EDIT: i hit "post comment" too soon lol, you can get the $base_url like this:

global $base_url;
print $base_url;

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz