vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Remembering "Collapsed" state on an non-vb page (https://vborg.vbsupport.ru/showthread.php?t=83349)

teonix 06-18-2005 07:26 PM

Remembering "Collapsed" state on an non-vb page
 
I'm trying to display some data from the forum on my main page (its not a vbulletin page, and vbulletin is installed in /forums/ whereas the main page i'm working with is in the main directory of the site)

What i'm trying to accomplish is to display the data in a collapsable box using the collapse function of vbulletin.

So far i've managed to get the actual collapse/expand function working correctly, but I am having difficulties getting it to REMEMBER the last state of the box (collapsed or expanded).

I've checked that it is setting the information into the cookie, and it is, so the problem must lie within reading and interpreting the cookie data?

Any ideas?

Let me know if you need more information...

teonix 06-21-2005 10:36 PM

Can't anyone help me out?

Basically I just need to know how to read & interpret vb cookie data from a non-vb page...

calorie 06-21-2005 11:00 PM

What cookie?

teonix 06-22-2005 06:47 AM

The cookie data for remembering the collapsed / expanded setting for content boxes ...

I think the cookie name is vbulletin_collapse

calorie 06-22-2005 09:12 PM

That cookie holds the names from onclick="return toggle_collapse('name') ..." and each name is separated by \n so perhaps use something like the following:
Code:

$cookie_val = $_COOKIE['vbulletin_collapse'];
echo $cookie_val."<br>\n";
$cookie_arr = explode("\n",$cookie_val);
print_r($cookie_arr);


Andreas 06-22-2005 09:14 PM

If you IDs are set correctly and vB cookies are accessible it should be stored/loaded automatically - if you have required global.php

teonix 06-22-2005 11:02 PM

That's what I can't seem to figure out.. I have the following in the top of my page, before any html .. I don't get any errors, so I assume its requiring it properly?

Code:

<?PHP
chdir('./forums');
require_once('./global.php');

?>


the onclick="return toggle_collapse('auction_cats')" function is properly setting the cookies, but when you load the page .. the content box loads "expanded" regardless of what you last set it to...


Is there another file or function i'm missing? I am currently including the global.php file and the vbulletin_global.js .....

My code on my mainpage that is trying to use the function is

Code:

<div class="myaccsecond">
<a style="float: right;" href="#" onclick="return toggle_collapse('a_cats')">
<img id="collapseimg_a_cats" src="http://www.mywebsite.com/forums/images/buttons/collapse_tcat.gif" alt="Show / Hide" border="0" />
</a>Title Here</div>
<div id="collapseobj_a_cats" style="$vbcollapse[collapseobj_a_cats]">

Content Is In Here

</div>

Looking at this, I realize that I probably need to wrap this in <?PHP ?> tags somehow? Maybe?
Code:

style="$vbcollapse[collapseobj_a_cats]"

calorie 06-22-2005 11:34 PM

1 Attachment(s)
Try the attached...

teonix 06-23-2005 06:14 AM

Hmm, I think i'm getting somewhere now :)

I believe the problem is being caused by the page not parsing the php, so i'm working on fixing this and we'll see where I get.

Thanks Calorie! You've been most helpful :) I'll be sure to bring this up again if I can't solve the rest of problem.


All times are GMT. The time now is 02:57 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00966 seconds
  • Memory Usage 1,723KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete