Topics

User Functions

Events

There are no upcoming events

What's New

Stories last 2 weeks

No new stories

Comments last 2 weeks

No new comments

Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

Downloads last 2 weeks

No new files

Welcome to Geeklog Sunday, December 04 2016 @ 05:27 pm EST

 Forum Index > Extensions > Cool Hacks New Topic Post Reply
 Give Blocks On One Side Same Look
Prev Topic Next Topic
   
Tony
 29/04/2002 09:28am (Read 21375 times)  

Admin

Status: offline
Site Admin

Registered: 17/12/2001
Posts: 405
Location:Urbandale, Iowa
OK, one of our theme masters wanted a way to dynamically make it so that when you change a block from one side to another, it will change it's template to conform to the side it is one. So let's say you have two sets of block templates:

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"Wink;
$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!



The reason people blame things on previous generations is that there's only one other choice.
 
Profile Email Website
 Quote
Anonymous: Anonymous
 30/04/2002 11:12pm  
Great new feature, but spot the missing word from this line:- SELECT onleft,name FROM missing-word WHERE is_enabled = 1"); Or perhaps I have missed something ????
 
 Quote
knuckles
 01/05/2002 06:41pm  

Chatty

Status: offline
Forum User

Registered: 17/12/2001
Posts: 36
Hi, I deleted Tony's reply because his answer to your question was commented out by the system - again. The problem was that the variable name in the original post and in Tony's reply was *not* allowable code and got parsed out - near as I can tell anyway. The code in Tony's original post has been fixed by using the ascii equivalents to the special characters. Just copy paste the code above and everything should work fine. Sorry for the confusion. Sincerely, Simon Lord
 
Profile Email
 Quote
Anonymous: Anonymous
 01/05/2002 08:44pm  
Looks like the filter is a little too sensitive :-) Thanks for the prompt reply. Cheers
 
 Quote
krove
 13/05/2002 10:47pm  

Junior

Status: offline
Forum User

Registered: 06/05/2002
Posts: 30
It is possible to use this to code the center block, giving it a different look (say for featured stories, warnings, or logout messages)? I think it would be easier on the user to differentiate normal stories from features, errors and messages in the center blocks with differing graphics. Just a thought.
 
Profile Email
 Quote
knuckles
 15/05/2002 09:30pm  

Chatty

Status: offline
Forum User

Registered: 17/12/2001
Posts: 36
Version 1.3.5 of Geeklog supports giving the Featured article a different theme from the rest of the articles.

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';

 
Profile Email
 Quote
Anonymous: superdood13
 10/02/2004 07:03pm  
where do you put the code for the new block templates? in the functions.php file?
 
 Quote
Bananiel
 22/02/2004 03:31pm  

Newbie

Status: offline
Forum User

Registered: 16/02/2004
Posts: 9
thanx for this hack i like it a lot ...
you can see the result on my website.


Greetz Daniel

http://www.bananiel.nl/
 
Profile Email Website
 Quote
adydas
 20/04/2004 05:41am  

Junior

Status: offline
Forum User

Registered: 26/02/2004
Posts: 33
$_BLOCK_TEMPLATE['whosonline_block'] = 'blockheader- right.thtml,blockfooter-right.thtml';


Where do you put this code. I have a custom block I want to make a new template for.
 
Profile Email Website
 Quote
Blaine
 20/04/2004 09:01am  

Full Member

Status: offline
Forum User

Registered: 16/07/2002
Posts: 1233
Location:Canada
In the theme directory you will see a functions.php file.

Geeklog components by PortalParts -- www.portalparts.com
 
Profile Email Website
 Quote
Anonymous: anony
 31/03/2005 12:36am  
Are these instructions still valid? I tried with the recent GL and didn't have much luck.
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!
 
 Quote
Dirk
 31/03/2005 01:21am  

Admin

Status: offline
Site Admin

Registered: 12/01/2002
Posts: 13073
Location:Stuttgart, Germany
Quote by anony: Are these instructions still valid?

Yes. Many themes use it - check the functions.php file of a few themes to get some inspiration.

bye, Dirk
 
Profile Email Website
 Quote
Content generated in: 5.49 seconds New Topic Post Reply
 All times are EST. The time is now 05:27 pm.
Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to post 
Filtered HTML Allowed 
Censored Content