By wingalingadingdong on
Hi
I'm trying to figure out how to theme with Zen theme.
I have a good view on the theming methods so far but what if I want to add or move a block myself?
There are a few predefined blocks that you can modify but there are also blocks you can't modify.
Like the site's Logo.
So I'm wondering how to move for example the site's Logo and how I can add blocks for example jquery popup containers?
Thanks in advance
D
Comments
^
Logo placement is set in page.tpl.php file in your theme's folder.
Most Jquery effects can be added from a module or you can embed them in the theme. Fir an example "back to top" motion-ease effects are better to exist in tye theme because no customization needed.
But for popups, form elements, etc, have a look at modules repo. You will find many good modules.
What's new and changing in PHP 8.4
Hi thanks for the reply. If I
Hi thanks for the reply.
If I look into the page.tpl.php file the footer is not editable.
The footer is being generated by this line
print render($page['footer']);so I can't really put the logo in the
I've tried creating a new
I've tried creating a new block and placing these lines of php:
But then I get an error saying I can't access the $logo variable:
Notice: Undefined variable: logo in eval()
Now I could just write code in a new block that points to the image but that would make drupals backend useless for changing the site logo. So I was wondering what the best practice is for these types of situations?
^
Why don't you add this code in the DIV of footer? It will look like a part of the footer. You will have to remove the DIVs in the above PHP code though.
What's new and changing in PHP 8.4
If you want to keep the code
If you want to keep the code in a block (easier to move to a different region), than this might do trick:
You don't need to wrap it with an if statment.
Hey thanks progpapa that's
Hey thanks progpapa that's exactly what I needed
I did however added the if-statement because if I tick of the logo in my backend I get an error.
So just to be save and align with drupals backend I've added this modified code of yours
If you want to use template
If you want to use template files:
- create a new file: region--footer.tpl.php and copy/paste the content of the region.tpl.php file (these two files should be in the same folder)
- copy the following code from page.tpl.php to region--footer.tpl.php:
(place it just below the
<div class="<?php print $classes; ?>">line)- in your template.php file add the following two lines to the zen_preprocess_region function:
- clear the cache
Most likely you're using a subtheme, so you should create/modify the template files in your subtheme.
Hope that works for you.
I've learn 2 more things from
I've learn 2 more things from this comment so thanks for the second method.
If I can define variables that would make my newly added block valid:
Which would be considered best practice?
If the only reason for
If the only reason for enabling the PHP filter module is to use this block, than I'd probably look for some other solution:
- either put the code in a template file and use a preprocess function to define the variables
- or write a simple module that creates the block (I'd prefer this one)