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
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
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
On Sunday 09 December 2007, 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.
You are correct. Nodes are indexed by the search module on cron run. In order for search to function, you need to enable the search module and then run cron, or more specifically setup cron to run periodically so that it can index any new content. (During development it's usually sufficient to just manually run cron from the status page every so often.)
On Dec 9, 2007, at 11:09 PM, Tom Holmes Jr. wrote:
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?
There's also contemplate: http://drupal.org/project/contemplate
This module was written to solve a need with the Content Construction Kit (CCK), where it had a tendency toward outputting content in a not-very-pretty way. And as such, it dovetails nicely with CCK, adding a "template" tab to CCK content-type editing pages and pre-populating the templates with CCK's default layout. This makes it easy to rearrange fields, output different fields for teaser and body, remove the field title headers, output fields wrapped for use with tabs.module (part of JSTools), or anything you need.
But Content Template can actually be used on any node type and allows modification of the teaser and body properties before they go out in an RSS feed or are handed off to the theme.