Welcome to Geeklog, Anonymous Tuesday, October 15 2024 @ 12:09 am EDT

Geeklog Forums

Toggle blocks


Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
excited
Want to let your visitors show/hide blocks?
Just released - toggle blocks for geeklog.
package contains a modified professional theme, and a javascript file.
This hack uses Javascript and DOM to change the page, so no page refresh is needed. It also tracks block visibility through cookies.
No change to the gl core.(so not really a hack)
Let your visitors hide single blocks, or all left/right blocks.

Very easy to install.

You can see them in action here,
and download them here.

Best of all, it's free Very Happy
If you would like your theme modified, let me know.
Support is available on my site.
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

sammykrupa

Anonymous
Love this idea!
 Quote

Status: offline

beewee

Forum User
Full Member
Registered: 08/05/03
Posts: 969
Location:The Netherlands, where else?
Nice, but I don't love to see visitors shut down my Adsense blocks.... Wink
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
sleepy
Honestly, if your visitor has seen your Adsense, and shut it. He is not going to click it anyways. And it would be open for the next visitor anyways. Also with an "if" statement in the js you could make adsense(or any block you choose) always open.

The one bug with this script is it doesn't like blocknames with apostrophes. The blockname is what makes each block unique so the script doesn't shut them all when you click one.
I'll have to look into naming them different, maybe with $bid or something. So for now, "who's online" has to be "who is online" and "what's new" - "what is new"...

Question for Dirk, can I use something like $bid or $_CONF('$bid') in blockheader.thtml?

Cheers
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?
Honestly, if your visitor has seen your Adsense, and shut it. He is not going to click it anyways.


Yep, you're damn right, but the blocks stay closed if the visitor clicks to another page of the same site, so the Adsense stays unvisible.

But what do I worry, my Adsense blocks are all hardcoded in the layout...
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by suprsidr: Question for Dirk, can I use something like $bid or $_CONF('$bid') in blockheader.thtml?

No (i.e. not without modifications to the code).

bye, Dirk
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
Ok so I created a modified function to reopen any block one would want:
Text Formatted Code
function toggle_init(id) {
var session = new CJL_CookieUtil("toggle_cookie", 1440*30, "/", "YOURDOMAIN.COM");
if( session.cookieExists() ) {
        if( session.getSubValue(id) == "none" ){
                document.getElementById(id).style.display = "none";
                document.getElementById(id+1).innerHTML = "<img src='http://www.YOURDOMAIN.COM/tabs/plus.gif' height='10' width='10' border='0' alt='Click To Show Block'>";
        }
        if( document.getElementById(id) == "NAME OF BLOCK TO REOPEN" ){
                document.getElementById(id).style.display = "block";
                document.getElementById(id+1).innerHTML = "<img src='http://www.YOURDOMAIN.COM/tabs/minus.gif' height='10' width='10' border='0' alt='Click To Show Block'>";
        }else{
                document.getElementById(id).style.display = "block";
                document.getElementById(id+1).innerHTML = "<img src='http://www.YOURDOMAIN.COM/tabs/minus.gif' height='10' width='10' border='0' alt='Click To Hide Block'>";
        }
}else{
        document.getElementById(id).style.display = "block";
        document.getElementById(id+1).innerHTML = "<img src='http://www.YOURDOMAIN.COM/tabs/minus.gif' height='10' width='10' border='0' alt='Click To Show Block'>";
}
}
 

So even if they closed say... all right blocks, and your adsense was in there, it would reopen rightblocks (of coarse not any others they had closed).

I integrated this script into a friends site, he has very long articles. It's great to be able to close all blocks and read full screen. I think this is a great tool for gl site owners.

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

All times are EDT. The time is now 12:09 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