2

I am new to drupal and drupal 7, I saw a video tutorial previous day regarding drupal 6, there they just used this:

print $content;
print $title;

to display post title and content separately however, in drupal 7 , I copied one of theme page.tpl.php file and there is only this:

 <?php print render($page['content']); ?> 

This shows full content inlcuding everything, how do I split them into parts like:

I want to customize my template like this

<div id="leftHolder">

                        <h1>Welcome to My site // for header </h1>

                        <p>

                            Some text Portion // 

                        </p>

 </div> 

This should be same for individual page and front page that shows 2 or 3 posts.

I tried making custom node.tpl.php file too, should I add some special function call to make it able to load content from node.tpl.php file ?

I pasted this code in template to render from page.tpl.php file of my theme

function connect_preprocess_page(&$vars) {
if (isset($vars['node']->type)) {
    $nodetype = $vars['node']->type;
    $vars['theme_hook_suggestions'][] = 'page__' . $nodetype;
}
}
1

1 Answer 1

-1

In page.tpl.php leave where ever you wants: <?php print render($page['content']); ?> and then use node--YOUR_NODE_TYPE.tpl.php and put content where ever you want. You habe $node object print it and see what variables it has. Make sure that you also have node.tpl.php - initial template file in your theme folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.