Hi all,

I'm new to Drupal, but have fair experience of HTML, CSS, JS and a bit of PHP. I've got a site already and wanted to move it onto a CMS, chose Drupal, downloaded and installed Drupal7 and then typed in all my content. But I can't get it to display.

I've tried to create a theme for my site (initially a zen subtheme, but that ended up in total confusion), so I thought I would create a new theme from scratch. How hard can it be? Very, it turns out.

Most of the online help/guides available are a mix of info for 6 and 7. So are causing some confusion. But so far I've got a .info with all my regions listed in it, and a page.tpl.php file, a template.php and a style.css

I've created regions, I've created blocks and assigned them to regions. I just can't actually get any of that to appear on a page.
The only clue I have is when I go to the content page I get a set of warnings such as: "Notice: undefined variable: header in include() line 1 of blah/blah/page.tpl.php"

I think this is because my page.tpl.php is trying to "print $header" (within PHP tags obviously).

Also the demonstrate block regions doesn't show any regions when I do that in block admin...

Please help I'm going round and round in circles and not getting any joy. Can anyone tell me where to start so I can actually get this thing to display a page?

Many thanks,
Sparks

Comments

greg_gy’s picture

Hi, welcome to the drupal community
In your page.tpl.php, drupal excepts a render array for your header. This page will maybe help you : http://drupal.org/node/930760
To give you my opinion, I think your first choice to create a zen subtheme was the best move. The code is full of informations to make your first steps in drupal theming. You will find in the README a step by step to make subthemes.
You could also watch some videos from the last drupalcons. Some of them helped me a lot! Since you have already a CSS, JS, HTML, PHP background, a book like "Pro Drupal 7 Development" could be the greatest starting point for you.

sparks’s picture

Hi Greg,

Thanks for the welcome and the steer. I have now got this working... I had been trying:
print $region-name and
print render($region-name);

If I could make a suggestion to the community - it could be useful to include a really simple explanation somewhere early on in the themes guide for D7 that says "at it's most simplistic level print render($page['region-name']); will print regions from Drupal 7 on your page."

It may be there somewhere, but in 2 weeks of searching I never found it.

Thanks again!
Sparks

roger.ajith’s picture

As i know, this error will solve by the following steps.
first, the region printing statement is as the following code.

print render($page['$your-regions']);

second, after creating any region, you should save the theme configuration in http://www.yourwebsite.com/admin/config/development/performance
And clear the cache in http://www.yourwebsite.com/admin/appearance/settings/yourtheme-name

Finally error will solve.

Oceanman’s picture

I have had this same problem, I want to add a region about the default content region. I'm using Drupal 7 and I am trying to work with a zen subtheme.

If I only use this code I do not get an error:

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

However, I thought I should have an if statement and to enclose this in a div. It only gives me an error "Notice: undefined variable:..." same as what you have been seeing.

I have tried the code below without the class="column" and it did not work either. Am I missing something big here?

What is wrong with this code:

	  <?php if ($content_top): ?>
        <div id="content-top" class="column"><div class="section">
		  <?php print render($page['content_top']); ?>
        </div><!-- /.section, /#content_top -->
      <?php endif; ?>
komal.savla’s picture

Hi,
@Oceanman: Replace your code with this :

<?php if ($page['content_top']): ?>
        <div id="content-top" class="column"><div class="section">
		  <?php print render($page['content_top']); ?>
        </div><!-- /.section, /#content_top -->
      <?php endif; ?>

Thanks,
Komal

Oceanman’s picture

Thanks @komal

Where can I find a listing of syntax changes from D6 to D7?

Perhaps you have an idea what is wrong with this syntax too. I am also trying to create 3 columns in a single content field but it just will not print any of my blocks. I have created 3 new regions in the info file:

regions[content_1] =  content 1
regions[content_2] =  content 2
regions[content_3] =  content 3

Then in the page.tpl.php file I have this but I do not get any joy:

		<?php if ($page['content_1'] || $page['content_2'] || $page['content_3']): ?>
		 <div id="new-content-wrapper">
			 <div id="new-content">
			  <?php if ($page['content_1']): ?>
				 <div id="content-1">
                                         <div class="content-3c"></div>
					 <?php print render($page['content_1']); ?>
				 </div>
			 <?php endif; ?>
 
			 <?php if ($page['content_2']): ?>
				 <div id="content-2">
                                    <div class="content-3c"></div>
                                    <?php print render($page['content_2']); ?>
				 </div>
			 <?php endif; ?>
 
			 <?php if ($page['content_3']): ?>
				 <div id="content-3">
                                    <div class="content-3c"></div>
				    <?php print render($page['content_3']); ?>
				 </div>
			 <?php endif; ?></div>
		 </div>
		<?php endif; ?>

I have the block options on my blocks page and I put in blocks of text.

EDIT: This is starting to work and I found a typo which I fixed. I think this is a css project now but I still would like to know where the "code syntax changes" from d6 to d7 are.

komal.savla’s picture

Hi,
You can refer this http://drupal.org/update/themes/6/7 for code syntax changes from D6 to D7.

Thanks,
Komal