Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By p0732658 on
Hi !
I would really like to add new region to the Garland Theme. I've tried the Zen Theme and it offer the block like those:
content-top
content-bottom
I know there are some documentation about doing this with the phptemplate engine, but the synthaxe doesn't seem to be the same. Does anyone did this in Garland?
Thank you
Comments
How to define custom regions
http://drupal.org/node/29139
Like I said, doesn't applies to the Garland theme...
Like I said, the documentation on Drupal Web site doesn't seem to applies to the Garland Theme because the syntaxe use in that them doesn't math the one use in the exemple provided in the documentation.
Seems to work for me
Replace "mytheme" with garland (or the name of your theme).
template.php :
Place the region within page.tpl.php :
Also, get rid of the hyphen (-) in your regions' names; use an underscore instead (_) = content_top
Perhaps you should read the documentation. It does "applies".
Thank you very much...
Thank you for your very clear explanation. I not a very got programmer, but this is very well explain...
I tried this, but my other regions don't show...
I tried adding the code to my template.php file into the Garland theme. The new content_top and content_bottom regions are shown, but node the originals regions. (sidebar left, sidebar_right, content, header and footer). Any ideas ?
To show all regions...
p0732658:
You need to consider this: when creating an overriding function in your own template.php file, you are replacing the original definitions, not adding to them. So you probably need something like:
Cheers.
That is exactly what I dit... and it Work!
Thank you for your replay. I figured this by myselft and it works. Anyway, thank you!
can't find function Garland_regions() in template.php (v5.1)??
Never mind, I just realized that the default is defined elsewhere, but this allows an override.
Seems to be working.
You can also do something
You can also do something like this to add a region (this gets the regions already defined in the theme engine (see phptemplate.engine) and adds a custom region at the end):
gpk
----
www.alexoria.co.uk
It works in D5. How about
It works in D5. How about D6? Any hints?
http://drupal.org/node/171205
http://drupal.org/node/171205#regions, http://drupal.org/node/171224.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Thanks pgk. In D6, it is
Thanks pgk.
In D6, it is easier. Just add the following to the garland.info
regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer
regions[top] = Top
regions[bottom] = Bottom
I just add Top and Bottom regions, but I need to add the above. Otherwise, the default regions (left, right, content, header, footer) will disappear.
Hyphens in themes
You also have to get rid of any hyphens that may be in theme names.
Works great!
horizontal Banner region in garland's blue band
Can anyone tell me how to insert a horizontal Banner region in garland's blue band.
This is not the header region.
It should appear in Garland's blue band across the top.
Thanks
anyone ?
anyone ?
subscribe
subscribe
Why don't you check this
Why don't you check this modified garland theme?
http://thanhsiang.org/faqing/node/59
The default header region is
The default header region is the thin pale blue strip across the top. Do you mean the darker blue region where the site title and primary and secondary links appear, or the pale blue stip just below this (and just above page content) where the breadcrumb usually appears?
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Yes, I mean the darker blue
Yes, I mean the darker blue region where the site title and primary and secondary links appear
I would do it like this:
I would do it like this:
1. Copy the entire themes/garland folder to sites/all/themes/garland2 so that I'm working on a copy of the theme not the original
2. Create a PHP file template.php in the main garland2 folder containing:
(but actually it's best to omit the closing ?>)
Then, in garland2's page.tpl.php, just before the line with
</div> <!-- /header -->
(i.e. just after the stuff about primary and secondary links), insert:<div id="header2-region" class="clear-block"><?php print $header2; ?></div>
Then use CSS to control the positioning/layout of #header2-region. You can also put this line higher up in page.tpl.php if necessary to get the layout you want.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Thank you very much. This
Thank you very much. This achieves the basic positioning that I require.
You mentioned "Then use CSS to control the positioning/layout of #header2-region."
Please can you elaborate a little on this ? Perhaps some sample code ?
Also how can I ensure that content in this region appears ONLY on my frontpage ?
>elaborate a little Well,
>elaborate a little
Well, this is basic CSS stuff. Have a look inside garland's style.css and look for #header-region to see how that is styled. You can similarly define the styling for #header2-region and control e.g. its vertical/horizontal alignment inside the containing
<div id="header">
. Maybe not necessary for your needs though.http://www.w3.org/Style/CSS/
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Thanks. Also how can I
Thanks.
Also how can I ensure that content in this region appears ONLY on my frontpage ?
On the block's configuration
On the block's configuration page, under "Show block on specific pages:", enter
<front>
.gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
about the div trick
i think now that the mini panels should be able to do the trick without messing up too much with theming but as you said i think it depends on one's needs...
Drupal 6
if someone wants to know how to do that in derupal six and above:
For display a block before the node you have just to add a new region in your theme, for example pluralism, go in the theme directory (sitename/themes/pluralism) and in the file pluralism.info in the follow lines:
add a new line called blocks.
After that you'll have something like:
Now you have just to clean the cache (Administration>Site building>themes>Apply)
and add
<?php print $blocks ?>
in page.tpl.php before
<?php print $content; ?>
Now you have just to go in the Blocks Administration and chose a block, afther thatin the sectors chose blocks,
Now you'll display before the block and after node
Enjoy;-)