The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
"If table is collapsed"
I posted this question in the Design and Graphics discussions but I think this is the right forum for my question.
I've provided some Google Gadgets http://www.google.com/ig/directory?synd=open on my vB 3.6.8 forum in a collapse table. I've got everything working, but would like to prevent the gadgets from downloading if the table is collapsed. So far it isn't a problem since there are only two but if I add more it will slow the page down when it loads. So how do I make a query that will prevent the gadgets from downloading when the table is collapsed ? Here's the code I'm using for the collapse table: Code:
<table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%" align="center"> <tbody> <tr> <td class="tcat" colspan="2"><a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('table_12')"><img id="collapseimg_table_12" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_table_12].gif" alt="" border="0" /></a>Search Links </td> </tr> </tbody> <tbody id="collapseobj_table_12" style="$vbcollapse[collapseobj_table_12]"> <tr> <td class="alt1" width="50%"><center>############## Google Gadget 1 ##############</center></td> <td class="alt1" width="100%"><center>############## Google Gadget 2 ##############</center> </td> </tr> </tbody> </table> So what I need is the code for "If table 12 is collapsed" and "If table 12 is expanded" |
#2
|
|||
|
|||
Tables are collapsed on the client side, everything is loaded first then collapsed based on saved settings, so I doubt this is possible.
|
#3
|
|||
|
|||
I cleared and then checked my cookies, then collapsed the table and checked again. There's a cookie "vbulletin_collapse" with content="my_table" (the actual name of the table in the forum) when the table is collapsed and empty when it's expanded. Can you write a query based on that?
EDIT: I collapsed several things on my home page and then "vbulletin_collapse" showed content for each feature collapsed. They were separated with %0A |
#4
|
||||
|
||||
what you are asking is not easy
first, you will need to do a check for the cookie (this is the easy part) HTML Code:
// Clean Cookie Vars $vbulletin->input->clean_array_gpc('c', array( COOKIE_PREFIX . 'my_table' => TYPE_UINT, )); HTML Code:
if ($vbulletin->GPC[COOKIE_PREFIX . 'my_table']) { // table is collapsed do this; } else { do this; } you can solve this in 2 ways (you will have to hire someone to do this for you) 1) ajax 2) skip the collapse/expand javascript and show gadgets based on a value saved for the end-user - this can be a cookie or a setting saved in the database ... either way the page will have to refresh each time the collapse/expand button is clicked confused |
#5
|
|||
|
|||
This is getting way over my head.
Is this a legitimate if query: <if ($vbulletin->GPC[COOKIE_PREFIX . 'my_table'])> ? If so, I could put it in each td and have it do nothing if true and get the gadget if false. Are you saying that if the user has the table collapsed from a previous visit and then expands it he will have to reload the page to get the gadgets to download? --------------- Added [DATE]1212767170[/DATE] at [TIME]1212767170[/TIME] --------------- Here's another possibility: The code in template reads <tbody id="collapseobj_my_table" style="$vbcollapse[collapseobj_my_table]"> in the tbody that collapses. When I look at the page source actually displayed I get style=" " when it is expanded and style="display:none" when it's collapsed. Can a query be based on this? --------------- Added [DATE]1212845272[/DATE] at [TIME]1212845272[/TIME] --------------- It doesn't seem necessary to look at the cookie directly as it is stored in several locations. I found my cookies listed four times in admin CP > Maintenence > View PHP info. They are listed in a group in Apache Environment under HTTP_COOKIE, in HTTP Headers Information under cookie, in PHP Variables under under _SERVER["HTTP_COOKIE"] and individually in PHP Variables under _COOKIE["......"] In particlular, the collapse variables for tables are under _COOKIE["vbulletin_collapse"], which lists all the collapsed tables. Can anyone show me how to make a proper "if" statement based on one of these? |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|