Starting a new theme from scratch, and i have looked at all the variables from Drupal.org which is kinda explained but not in detail.

Like if i do print $content it will output my entire article with

Title by author
Article content
Comment link

I kinda need to control every aspect of this, is it anyway i can output just the title , or just the article content ? I need to do it that cause i have a very unique design i am gonna put it into. So i cant have Drupal outputting entire contents without me controlling every aspect of it hehe.

And how do you output the user menu ? So i can edit profile and visit Administration Area.
I see default themes have it, but tried several variables and cant seem to output it. Which variable does it come from ?

Comments

ainigma32’s picture

This should get you started: http://drupal.org/theme-guide

Try reading through and then post back any questions that pop up.

HTH

Arie

JohnnyHa’s picture

I have read it but it only covers some basics behind a theme.
Just want to know every variable so i can output what i want to show.

Just to give you an idea.

<div id="news">
<?php print $newstitle ?>
<?php print $newscontent ?>
<?php print $comments ?>
</div>

Just an fast and rough example here. Just need to know what the variables are called for all of this, not only this but for showing loginbar as well :)

Couldnt find any info on this at drupal.org.

ainigma32’s picture

Use a preprocess function to dump the variables array:

function phptemplate_preprocess_page(&$vars) {
  echo '<pre>'. print_r($vars) .'</pre>';
}

Alternatively you can use the Devel module to inspect the variables that are available.

HTH

Arie

JohnnyHa’s picture

Any specific requirements for this to work ? Tried inputting:

function phptemplate_preprocess_page(&$vars) {
  echo '<pre>'. print_r($vars) .'</pre>';
}

in my page.tpl.php file but nothing was shown.

ainigma32’s picture

Stick it in the template.php and it should work.

- Arie

JohnnyHa’s picture

Hmm nothing, it should come up at the front of the page ? Nothing is shown here. Weird.

ainigma32’s picture

Here?

- Arie

JohnnyHa’s picture

; $Id$
name = Test
description = Test theme.
version = 1.0
core = 6.x
engine = phptemplate

ainigma32’s picture

Seems to work at my end:

/themes/test/test.info :
- Exactly what you posted -

/themes/test/page.tpl.php :

<html>
<body>
<h1>Test</h1>
</body>
</html>

/themes/test/template.php :

function phptemplate_preprocess_page(&$vars) {
  echo '<pre>'. print_r($vars) .'</pre>';
}

And you just get a blank screen?

JohnnyHa’s picture

Yeah all i got is the word Test from the page.tpl.php file. Everything else is blank .

My themefolder only has .info , page.tpl.php ,style.css and template.php.

ainigma32’s picture

Or was that just a typo?

JohnnyHa’s picture

yeah its called test.info :)

ainigma32’s picture

That's really the last thing I can come up with.

Next thing you could try though is to install the Devel module and see what kind of info it gives you.

JohnnyHa’s picture

Also done that, installed the devel module and enabled logging but i cant see anything special when viewing my theme. Should variables come up automaticly ?
Anyways appreciate your help.

ainigma32’s picture

See here http://drupal.org/node/209561

That should get you started with Devel. Hope you find the problem. I'm starting to get very curious as to why you can't see the output of the print_r statement.

- Arie

JohnnyHa’s picture

Got Devel to work now, awesome :) But Devel fins function names. Like i found in my news the function is called phptemplate_node_submitted.
How do i output it in my theme ? I tried $phptemplate_node_submitted and $test_node_submitted but didnt work.

Sorry for dumb questions but this CMS confuses me :)