Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 10:50 am EST

Geeklog Forums

How to get the block name in the block template?


Status: offline

beewee

Forum User
Full Member
Registered: 08/05/03
Posts: 969
Location:The Netherlands, where else?
I'm trying to make some tabbed blocks with Tabpane (http://webfx.eae.net/dhtml/tabpane/tabpane.html).

I've got it working like a charm (testsite: (http://www.boeken-winkel.nll) but would like to integrate it a little bit in GL. For now I'm using a block with an empty blocktemplate filled with the required HTML and Javascipt code, but it would be nice if it could be used for portal blocks and php blocks as well.

Tabpane uses named tabs like "tab-page-1" and "tab-page-1" to identify the tabs and content. The block-name field would be perfect to use for this names, how can I put the block-name in the blocktemplate? The tag {block_name} or {bid} doesn't do the trick.

If somebody could help me out it would be possible to make blocktemplates for the first tab named "tab-page-1", blocktemplates for the next tabs (named tab-page-2, tab-page-3 etc ) and one for the last.
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
 Quote

Dazzy

Anonymous
suprsidr used to offer a solution for this dont know if he still does or if its still supported.
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
I dug 'em up.
But its been awhile since I've looked at them.

as an example though - I recently made a theme which uses yahoo's lib to render movable/draggable blocks.
In short I needed someway to name each block element dynamically:
eg. blockheader-left.thtml
Text Formatted Code

<script language="javascript">
<!--
    var el = strip("{block_title}");
    document.write("<div id=\""+el+"\">\n");
    document.write("<div class=\"hd\"><h2>{block_title}</h2></div>\n");
    document.write("<div class=\"bd\">\n");
    myPanel = new YAHOO.widget.Panel(el, { width:"180px", visible:true, constraintoviewport:true, underlay:"shadow", draggable:true, close:true} );
    myPanel.render();
//-->
</script>
 

needed a function to strip spaces and apostrophes from blocknames:
Text Formatted Code

function strip(str)
{
  var ret = '';
  for (i = 0; i < str.length; i++)
  {
    if (str.charAt(i) != ' ' && str.charAt(i) != '\'' )
    {
      ret += str.charAt(i);
    }
  }
  return ret;
}
 


-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

beewee

Forum User
Full Member
Registered: 08/05/03
Posts: 969
Location:The Netherlands, where else?
@suprsidr: Thanks very much, but I'm simply looking for a way to produce the block ID in the blocktemplate, the tabbed interface is already finished.

But I realise there's another way: I'll make some blocktemplates with a hardcoded fake block ID, and use the functions.php in the theme to use these templates for the corresponding block ID's. I want to use 2 sets of 4 tabs, so that's a piece of cake.

EDIT: I'll make a tutorial and release the files when it's ready and running.
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
 Quote

All times are EST. The time is now 10:50 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