Welcome to Geeklog, Anonymous Saturday, September 07 2024 @ 08:03 pm EDT

Geeklog Forums

custom images for each block


Status: offline

jjkiesch

Forum User
Newbie
Registered: 02/26/05
Posts: 5
Location:dallas, tx
is there any way of pulling the block name of the current block being displayed in the template?

i am wanting to but the block name in the id of my tags so that i can use CSS to pull different images for each block.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
You would need separate blockheader / blockfooter template files for each block, but it's doable.

Geeklog lets you override the standard blockheader and blockfooter templates for blocks. Have a look at the functions.php of your theme and also read this.

bye, Dirk
 Quote

Status: offline

jjkiesch

Forum User
Newbie
Registered: 02/26/05
Posts: 5
Location:dallas, tx
hmmm... sounds a little more complicated than i thought it would be. i was hoping you could call the block name from the database the same way you'd include the title or the information in it, like {block_name} or something like that. oh well, i'll look into it.
 Quote

Status: offline

drshakagee

Forum User
Full Member
Registered: 10/01/03
Posts: 231
Here is what I did in lib-common.php file there at around line 1144 add this:
Text Formatted Code

    $patterns[0] = "/'/";
    $patterns[1] = "/ /";
    $replacements[0] = "";
    $replacements[1] = "";
    $block->set_var( 'block_id', preg_replace($patterns, $replacements, $title));

 

right after this line:
Text Formatted Code
    $block->set_var( 'block_title', stripslashes( $title ));
 

Then in your block template files you can use {block_id} as your class name. the replacements are to make the {block_id} a valid class name.
Yes I am mental.
 Quote

All times are EDT. The time is now 08:03 pm.

  • 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