[support] Change Node Display

Tom Holmes Jr. tom at tomholmes.net
Mon Dec 10 15:23:51 UTC 2007


Ah yes ... I own that Drupal book and the Packt one as well.   I find 
the Pro Drupal Development book much better, and I was reading Chapter 8 
as you responded.

I am making progress on changing how the node is displayed.  I removed 
the $content variable, and replaced it with $body ... but a very 
familiar issue pops-up:
http://drupal.org/node/160641 and  http://drupal.org/node/161284
where because I am using the CCK, all the extra fields are being tucked 
into the body, so when you display the body, you get all the other 
fields also.
I was definitely up to 2 am last night researching this issue ... and 
it's definitely not me.  And there are some definite work arounds.

So ..... what I did was erase the name of the body field as to make that 
not display.   Works perfectly.
I added my own"real_body" field and made it a text field, and made it 
required ....  However .....
the cck text field only shows a thin text field.   Ideally, I'd like to 
make this a textarea like the original body was.  
Is that possible?

Also ... I found that the text fields stuffed data into an array, so in 
order to put that in my node.tpl.php, I had to use: 
$field_name[0]['value'] .... and that seemed to work.   Is that the 
correct way to do that?

Again, thanks for all the help!
                                                                  Tom


Steve Edwards wrote:
> You can create separate template field for each type of node you create.  All you do is take the node.tpl.php file and rename it 
> to node-nodetype.tpl.php.  So for instance, if you wanted to create a separate template for blog nodes, you would clone 
> node.tpl.php and name it as node-blog.tpl.php.  If you want to get even more fancy, you can use PHP code in template.php to 
> specify which template file to use in certain cases.
>
> All of this is explained in Chapter 8 of the "Pro Drupal Development" book, which you can download for free at 
> http://www.apress.com/book/downloadfile/3486.  What I just discussed is on page 119.
>
> Steve
>
> Tom Holmes Jr. wrote:
>   
>> Ok ... so now that I have a working, stable copy of Drupal 5.5 on Resin 
>> 3.1.4, now I can start learning Drupal again.
>>
>> Now .... if everyone has lost patience with me ... I have a Post 
>> Installation question to ask .... maybe a couple ...
>> And all you have to to is point me in the right direction, or ask me for 
>> any more information that is needed.
>>
>> So, I created a new content type with cck, the date field, image field, 
>> and link field .... no problem whatsoever.
>> For some reason I can't search for the Node, I get some SQL error 
>> message .. but that's ok ... not a big problem.  
>> I presume the one and only node I created is not indexed yet .... I'll 
>> experiment with that ... besides I have a lot of data to import anyway.
>>
>> I guess my question (finally) is:
>> Are all content type nodes viewed with the same theme or php code, 
>> because obviously different content types have different fields.
>> I would like to change the way content in a node is displayed for 
>> different content types, is this possible and can you point me to the 
>> right place?
>>
>> Thanks!
>>                              Tom
>>
>>     



More information about the support mailing list