By navs on
Hi,
I'm trying to customize the page node completely, therefore I'm trying to get the output of the code that is returned for:
<?php echo ($content); ?>
So I'd like to get the code printed on the page instead of the formatted text output alone. How can this be done?
Thanks
Navs
Comments
It depends on the context,
It depends on the context, in page.tpl.php $content is generally controlled by another template function or file (details will depend on the page being viewed. A common example is pages that display a single node (path of the form node/[nid]), in this case $content is a single node and produced from node.tpl.php (which has its own $content)
Nevets, I want the content
Nevets, I want the content type "book's" content. I need its separate fields so that I can invoke them where ever on the page I wish to.
Details:
I have a book page, that I want to customize. So I created a page.node.book.tpl.php file and added its name in template.php in the function:
I then copied page.tpl.php and pasted it into page.node.book.tpl.php. Now I want to style the content by separating the elements within $content.
How can I get the separate parts so that I can do the styling of the book?
Can you please help.
thanks
Navs
In that case you can copy
In that case you can copy node.tpl.php to node-block.tpl.php. In node-block.tpl.php at the end you can add
to see the parts that go into $content (in the context of node.tpl.php)
Nevets, the content within
Nevets, the content within the node has all the elements besides the book's content as well. Here is the problem
I changed the code within template.php to
and created a copy of node.tpl.php and called it node-book.tpl.php.
When I uploaded this to the site, it is missing the header and the left navbar and merely showing the content of the book alone. Here is the problem. If I copy all the code from my page.tpl.php and paste it into node-book.tpl.php, it is showing the header bar twice, once at the top of the page like it regularly does and once within the content area.
What is going on?
Take a look at:
http://www.dropshots.com/jongleur#date/2009-05-18/10:55:10
Remove the code from
Remove the code from phptemplate_preprocess_page(), templates of the form node-type.tpl.php are a) node templates (vs page templates) and b) automatically handled by Drupal.
Thanks Nevet, that was the
Thanks Nevets, that was the mistake, I took it out and it works perfectly.
print_r seems to just output all the text without line breaks etc. Is there anyway to output the code formatted?
the reason I ask: I want to bring the links to child pages in the book module to the right nav bar, that's primarily why I wanted a function like print_r.
By default, the child pages link is available in the bottom in a book module, I want to move them to the right and style their output.
Any suggestion?
Thanks for your help.
Navs
The print_r is really just
The print_r is really just for testing so you can see how to access the parts. Normal one uses print for individual fields and uses HTML to structure the output and css to style..
Thanks Nevets. I tried as you
Thanks Nevets. I tried as you said and used print print_r together to see all the parts of the content field. However, I still am unable to invoke the fields individually. I tried the following:
Nothing is being printed. What could be the reason? please help.
thanks
Navs