Changing layout of custom content type
public
group: South Africa
GlitchFreak - Thu, 2008-07-10 19:05
Hi There
I've created a custom content type using CCK and all works (well, most of it) :o) I would like to know how difficult would it be to rearrange the content on the page?
For instance, instead of having all content underneath each other, I would like the text fields on the left of the page and the image on the right.
Also, is it possible to create one page with 2 or more instances of a content type on it, arranged of course?
Thanks in advance for all the assistance :o)
K


Contemplate
Hi
All can be done with the contemplate module (Content Template)
http://drupal.org/project/contemplate
Theme the content type
Hi
Contemplate is a good place to start. It allows you to specify formatting for nodes using PHP.
However, I think that the best way is to theme the format of your content type is using a file named node-content_type.tpl.php to do the formatting. You can read more about that here. That is the approach I used to theme activity nodes on my first site and it works well. Example
I'm sure that there are plenty of good ways of creating a page with multiple nodes on it. My first instinct would be to createa view that does this for you. Otherwise look into the excellent Panels module which allows you to set this kind of thing up. Panels 2 is very powerful but tough to learn so you might want to use the older Panels 1 for something simple like this.
Al
Using just CSS is also an option
Depending on what you're trying to do, you can use css to accomplish a lot without having to create a new template. Use firebug to find the css id or or a class you could use to target your image, and float it right. You can also change the ordering of fields by editing your content type clicking on the "Manage fields" tab and changing the weighting. You can also hide field labels (or make them display inline) byclicking on the "Display fields" tab and playing with the "Label" options.
If you're in the Joburg region, come to the Meetup on Saturday - there will be lots of drupalers who'd be happy to help you out :-)
http://groups.drupal.org/node/12915