vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   toggle_collapse closed initially? (https://vborg.vbsupport.ru/showthread.php?t=124899)

AutomatikStudio 08-25-2006 03:06 PM

toggle_collapse closed initially?
 
Is it possible to make the collapse forum buttons on the forum home be initially collapsed instead of initially open?

I only need it to be this way on the forum home and just for the forum listing.

Oreamnos 10-30-2006 04:22 AM

I think I got this figured out with a little help from a poster at vb.com.

So basically in the template that contains the collapse object you want to put in the following code:

PHP Code:

<if condition="!$_COOKIE['vbulletin_collapse']">
    <
script language="JavaScript" type="text/javascript">
    <!--
        
toggle_collapse('yourcollapseobject');
    
// -->
    
</script>
</if> 

Make sure you place that under the part in your template where you want it to work.

So basically, this sets the cookie for that object as soon as the page loads instead of waiting for the user to click it. Then once the cookie is set, it doesn't call the collapse function anymore and just relies on what the user chose as their option.

It seems to work for me but if anyone finds a problem, please post it.

So in your example AutomatikStudio, if i understood you right, you would use toggle_collapse('forumbit_1'); and that would collapse your first parent forum.

Hope that helps someone.....

pogo 05-15-2007 11:10 AM

The problem with this code is that you can't have all objects expanded if you want to because then $_COOKIE['vbulletin_collapse'] is empty and the condition turns out to be true which leads to collapsing the specified objects.

Oreamnos 05-16-2007 08:21 AM

Quote:

Originally Posted by pogo (Post 1247980)
The problem with this code is that you can't have all objects expanded if you want to because then $_COOKIE['vbulletin_collapse'] is empty and the condition turns out to be true which leads to collapsing the specified objects.

that's true and im not sure how to solve that issue. maybe create an empty, hidden and collapsed object.


All times are GMT. The time now is 02:14 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.01074 seconds
  • Memory Usage 1,719KB
  • 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
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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