Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 05:44 am EST
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.
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.
9
7
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
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.
8
8
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:
$patterns[0] = "/'/";
$patterns[1] = "/ /";
$replacements[0] = "";
$replacements[1] = "";
$block->set_var( 'block_id', preg_replace($patterns, $replacements, $title));
right after this line:
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.
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.
10
10
Quote
All times are EST. The time is now 05:44 am.
- 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