I am developing a site with a custom theme based on BlueMarine. I had to make some changes to the way Drupal normally processes a set of nodes selected by taxonomic terms. I took the following approach:
1. Define a new block with a block template which selects the nodes and formats them to my requirements.
2. Place the block in the content region of the page.
This displayed the nodes as required, but Drupal still displayed the nodes according to its own rules as well. I couldn't figure out a way to make it stop, so I continued:
3. Edit the theme's .info file; explicitly define the header, footer, and sidebar regions, but not the content region, and define a custom "Body" region.
4. Place the block defined in step 1 in the Body region.
5. Modify the page template to print $body instead of $content.
Then my pages displayed the content just once, in the correct form, but -- surprise! -- the administrative pages had no content at all, since my page template was no longer displaying $content, and my block template was putting nothing into $body for those pages. I therefore added one more step:
6. Modify the page template again to print $content for admin pages only.
Now everything looks the way I want, but a couple of issues puzzle and/or trouble me.
First, after I finished I realized that I had never restored the definition of the Content region in the .info file. As I understand the behavior of phptemplate, that should prevent Drupal from creating the $content global at all. Why is it still doing so?
Second, how can I make Drupal stop collecting content in $content outside the administrative pages? I didn't think through the implications completely, but I omitted defining the content region precisely to avoid the overhead of doing that. For the sake of efficiency, I still want to avoid it if I can.
Comments
See if this works
Hi jhsachs,
Try the following funtion in your theme's template.php file.
Just add a new instance on the array eg ( 'whatever' => t('whatever') ). You may want to change phptemplate to your theme name. You then put
print $leaderboardin the position where you want the new region to be. It should be available in your theme to assign content to.let me know if that works, it should allow you to create new regions.
Todd
Thank you, but
I appreciate the thought, but you misread my post. You've explained another possible way to solve the problem I have already solved, without addressing the remaining issues.
I don't know whether the technique you described will work in Drupal 6. My understanding is that the technique I used is the recommended one, if not the only one that works. It is described in the theme guide.
If your technique does work, and if it does suppress the construction of $content, it just makes the remaining issue critical: how to suppress $content for non-administrative pages only.
In principle, I could solve that problem by using a different administrative theme. I began my project that way, but I gave it up because Drupal appeared to be applying some of my base theme's properties to the administrative pages anyway. I could go back to that design, but it would be messy.
Ok
I've not explored drupal 6 as yet, I'm waiting till views and cck are production ready. But as far as I know, I have never heard of it being best practice to change the .info file of a template (could be wrong though).
Sorry I could be of more assistance, I would put it out there for any other expert drupal users to solve this one.
Bump
Can anyone experienced with Drupal 6 shed light on this?
I suspect Drupal assembles
I suspect Drupal assembles $content by default, as part of the initial node construction. You can add anything to $vars, and it doesn't necessarily have to end up in the template. Declaring it in the template as a region only tells the template it has a region called "content" - it does not tell drupal that there is content to go in that region or what that content is.
xtfer.com
platform.sh