By rhughes on
So, I have setup a content type called 'Client Page' and within it I have setup 2 CCK fields:
Client Content which is multiple text fields (this is the only field the client can edit)
and
Developer content which is a text area with the PHP input filter enabled. What I am trying to do is develop pages using HTML and then using PHP to print the values inputted by my clients i.e.
<div>
<h2>Address:</h2>
<?php print $node->content->['field_clientcontent'][0]['value']; ?>
</div>
I tried this on the Body field and it works (UPDATE: I am unable to get it working for the Body field) but for some reason when I try to php print using my custom CCK field nothing shows up..?
Any Ideas would be greatly appreciated.
Thanks,
rhughes
Comments
devel
Install the devel module http://drupal.org/project/devel then you'll get some debugging tools.
You can then do a
which will give you access to a JavaScript variable browser then you get a better idea of what you've got access to
Peter J Lord
http://peterjlord.co.uk
Hmm, I installed the module
Hmm,
I installed the module and went into the dev tab for the page and saw this listed:
So that field is apparently available...
I believe there is an error
I believe there is an error here.
Should be
Also, it's dirty, but you can always do a
in your node template and look at the source code to see some structured goodness for this content type
So this is really weird, when
So this is really weird, when I simply enter
It returns nothing, its like the $node variable is not recognized.
..because I can execute
and it will show up just fine, so the PHP filter must be working correctly...
In which template is that. If
In which template is that. If you are in page.tpl.php, are you looking at a full node page? If you are looking at a teaser list of many posts, of course there is no one $node.
It sounds like you want to
It sounds like you want to theme the node, in Drupal we use templates for that. Your PHP field does not have a default $node.