开发者

Easy way to get Drupal Header and Footer?

The title is probably not the best description. I want two functions开发者_如何学JAVA:

getHeader();
getFooter();

The header must return all the content in the template.php file BEFORE

print $content;

And the latter must return everything after it.

Is this possible?


Instead of trying to get the all except $content and wrap your display in it, why don't you just take your content and theme it (put it into $content). That will be a lot easier, Drupal was meant for this.


Drupal makes use of "regions". What you can do is give your site three regions (header, content, footer).

Regions are defined in the theme's .info file in the form "region[backend_name] = Title that shows up in frontend". Having the regions "header", "content", and "footer" could be defined thus:

region[header] = This is the Header
region[content] = This is the Content
region[footer] = This is the Footer

After defining the regions in the .info file and enabling the theme, each region can be printed using the backend name thus:

print $header;
print $content;
print $footer;     

Blocks are assigned to a region at /admin/build/block

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜