Content Type 'Page' theming

martinteractive - November 10, 2009 - 21:58

Hi guys!,

I'm working on my first Drupal theme right now, and like everyone I'm starting with some troubles.

The content of every page with the content type 'page' should have 2 text blocks, a 'intro text' and a 'body text' block.
I created a extra text block with CCK. That's working already! ( Ow man, what was I confused that a Drupal beginner can make something like this ;) )

When I open the page with a introtext en a body text it's messed up because it isn't styled. You can see a it here hosten on my test environment.. Click to website!.

With some styling it has to look like this.. Preview image

So I should make a template file where I call on to a Title, The CCK custom 'field_intro_text' field and the standard 'page' body text. I tried it with a node-page.tpl.php file. But I don't know how I can import the needed fields.

I don't need help with styling these elements, that's not a big deal for me.

Can anyone help me a step on the good way with this? Thank you in advance!

Do you have Devel module

armababy - November 10, 2009 - 22:30

Do you have Devel module installed ? It can help you big time with Theme developer feature.

Yes, I have the Devel module

martinteractive - November 11, 2009 - 13:47

Yes, I have the Devel module installed, but I still don't know how I can insert the specific field in the, still don't know which, template.

In your node-page.tpl.php:

Hasse - November 11, 2009 - 22:55

In your node-page.tpl.php: insert this code:

<?php print $node->content['field_intro_text']['field']['#title']?>
      <?php print $node->field_intro_text[0]['value'] ?>

That should do it, but I'm not sure if it's safe because the value not is sanitized.

I've fixed this 'beginners

martinteractive - November 17, 2009 - 14:44

I've fixed this 'beginners problem' with this code:

<?php
print $title;
?>

<?php
print $node->field_intro_text[0]['value']
?>

<?php
print $node->content['body']['#value']
?>

Is this a good solution?, or is there a better one?

 
 

Drupal is a registered trademark of Dries Buytaert.