Welcome to Geeklog, Anonymous Wednesday, July 09 2025 @ 02:06 am EDT
Geeklog Forums
Give Blocks On One Side Same Look
Set 1: blockheader-left.thtml and blockfooter-left.thtml
Set 2: blockheader-right.thtml and blockfooter-right.thtml
Now typically you set a custom template for a block by going:
$_BLOCK_TEMPLATE['<block_name>'] = '<header_template>,<footer_template>';
If you want to do this dynamically for both sides you would add this little bit of code to your functions.php for the theme you are working in:
$result = DB_query("SELECT onleft,name FROM {$_TABLES['blocks']} WHERE is_enabled = 1"
$nrows = DB_numRows($result);
for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray($result);
if ($A['onleft'] == 1) {
$_BLOCK_TEMPLATE[$A['name']] = 'blockheader-left.thtml,blockfooter-left.thtml';
} else {
$_BLOCK_TEMPLATE[$A['name']] = 'blockheader-right.thtml,blockfooter-right.thtml';
}
}
Enjoy!
As for the rest, if you know the block name you can specify a custom theme as you wish. Here's a sample courtesy of Tony Bibbs as given to me (alter the code to suit your needs):
$_BLOCK_TEMPLATE['whosonline_block'] = 'blockheader- right.thtml,blockfooter-right.thtml';
you can see the result on my website.
Greetz Daniel
Where do you put this code. I have a custom block I want to make a new template for.
I was wanting the right blocks have unique colors in the text and backgrounds (different from the left block text & background colors)
Using GeekLog v1.3.11
Thanks in advance!
Yes. Many themes use it - check the functions.php file of a few themes to get some inspiration.
bye, Dirk
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content