I'm sure there is a great big section somewhere explaining exactly how to do this, but I haven't yet found it.

Basically, lets imagine I have created a Content Type called "Song" and then using CCK I've create fields called "SongTitle", "Artist", "Genre", "Album", attach a "CoverArt" file etc.

I now allow authenticated users to create content of type "Song".

So, a user clicks on the link to create a new Song and they are presented with a screen displaying the fields to fill in. What I want to do is customise the look of this screen so that it looks a bit prettier.

Similarly once a Song has been entered it can be viewed. When a user views a Song the screen is laid out is a particular way, but I want it to be laid out differently, with the cover art displayed amoungst the content.

I don't think creating a custom theme is the right thing to do, and next I thought the Views module was what I was after, but it appears not.

I don't need to be told exactly what to do, I just need a pointer to the right section.

Thanks for your help.

Thanks
Ben

Comments

zeta ζ’s picture

I’m struggling with this too.

Some of the options available to customise the appearance of a CCK type only apply to the presentation of the data, not to the form used for input. I am customising my theme to design the input form: Customising the presentation should be easier, using the options provided by CCK as well as theming.

BenS1’s picture

Thank.

Where does CCK give you options for presentation?

All I can see is the weighting to control the order in which the fileds are displayed, but I need much more control than that.

I guess I'll have to dig into themes.

Thanks for your help

Ben

r0g’s picture

Themeing is the way to go if you need to change the look of these views.

All the view's output should be well tagged with css classes & id's so you can manipulate sizes, colors, background images and more with simple CSS. If you need to change the order of your fields you can use views. Anything more complicated than that e.g. adding extra structrure/tables/classes/ids and you'll need to get your hands dirty and use a bit of php, though this is often simply a case of copying a node.tpl file and copy/pasting the lines around.

Roger Heathcote - www.technicalbloke.com

mirnazim’s picture

In Drupal 5.x, You can also have different tpls for different urls.
For example:
node-add-story.tpl.php will apply to ?q=node/add/story in node context
page-node-add-story.tpl.php will apply to ?q=node/add/story/ page context

By node context I mean you can change the look and feel of the particular node form layout and page context means you can change the appearance of full page layout.

BenS1’s picture

Ok, so I need to create a custom Theme to control the presentation of the content?

PHP is fine... I've done a lot of advanced PHP in the past.

So, just to confirm, imagine I had a news website whereby the user enters a news story and uploads some pictures... if I want to get a page layout like this:

http://news.bbc.co.uk/1/hi/uk_politics/7106524.stm

i.e. with the pictures and comment blocks in amoungst the actual story content, then the best way is to customise the theme?

What the the tpl files? Is that some kind of theme template file?

Thanks again
Ben

yelvington’s picture

Views is a database query generator. It's not a presentation engine, although it has some nice precooked presentations included in the module.

Similarly, CCK is for managing the creation of structurally complex content types, not for managing the output.

In both cases, there are other tools for output formatting, but they're fairly primitive in that they expect you to know how to work with the phptemplate engine.

The Views Theme Wizard gives you a headstart on generating the necessary code for arbitrary custom presentation but you have to know what you're doing. The Wizard gives you code that you can further modify, then splice into files (for CSS, .tpl.php, and template.php).

For CCK, contemplate (content template module) is your friend.

It will help you manage the detailed formatting of the $content component of a node, but again, you have to be somewhat comfortable working with PHP.

You'll be working with the somewhat obscure internals of the $node object.

Basically you point/click to add CCK fields to the $content string, and contemplate splices the necessary code into a textarea. You can reach in and add HTML formatting as you desire. When you're done, everything gets stored back in the database. From the point of view of the phptemplate engine, node.tpl.php gets handed a "cooked" $content value that is formatted the way you specified, rather than the fairly limited control over $content that you get from CCK natively.

Without contemplate you can do the same thing, but you'd have to do it directly in node-type.tpl.php files and you'd be doing a lot of print_r($node) to figure out the proper notation for grabbing a CCK field.

Before going down this road, be sure to read and THOROUGHLY understand the theme developer's handbook.

BenS1’s picture

Views is a database query generator. It's not a presentation engine, although it has some nice precooked presentations included in the module.

Ok, so it mean Views as in database Views, not presentation views. Thats fine, I work with Views and Stored Procs all the time.... I just misinterpreted it in the Drupal world as meaning Views as in how things are presented.

Similarly, CCK is for managing the creation of structurally complex content types, not for managing the output.

Ok thanks.

In both cases, there are other tools for output formatting, but they're fairly primitive in that they expect you to know how to work with the phptemplate engine.

Ok thanks again, so I need to look at the phptemplate system? Thats fine, I'm sure I can work it out now that I know what to look at.

The Views Theme Wizard gives you a headstart on generating the necessary code for arbitrary custom presentation but you have to know what you're doing. The Wizard gives you code that you can further modify, then splice into files (for CSS, .tpl.php, and template.php).

I think thats where my confusion came from regarding Views. So Views are database views, but the Views Theme Wizard helps you present the output of the DB view in a certain way?

For CCK, contemplate (content template module) is your friend.

I'll take a look, thanks.

It will help you manage the detailed formatting of the $content component of a node, but again, you have to be somewhat comfortable working with PHP.

Yep thats certainly not a problem. Just got to learn the Drupal APIs.

You'll be working with the somewhat obscure internals of the $node object.

Basically you point/click to add CCK fields to the $content string, and contemplate splices the necessary code into a textarea. You can reach in and add HTML formatting as you desire. When you're done, everything gets stored back in the database. From the point of view of the phptemplate engine, node.tpl.php gets handed a "cooked" $content value that is formatted the way you specified, rather than the fairly limited control over $content that you get from CCK natively.

Without contemplate you can do the same thing, but you'd have to do it directly in node-type.tpl.php files and you'd be doing a lot of print_r($node) to figure out the proper notation for grabbing a CCK field.

Before going down this road, be sure to read and THOROUGHLY understand the theme developer's handbook.

Ok thanks. I'll get reading! :)

Thanks for your help, much appreciated.
Ben

BenS1’s picture

I just wrote a fairly long reply to this, but it appears to of disappeared! Strange!
I hope thats not a common problem with Drupal comments?!

Anyway in summary of what I wrote before, thanks. I'm very comfortable with php so I'll take a look at the things you suggested.

I didn't realise it means Views as in database Views, I thought it mean view as in presentation! I should of known better as I work with Views and stroed procs in SQL Server every day!

Thanks again
Ben

BenS1’s picture

So my longer post did show up, eventually. Didn't realise that there is a delay.