Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-19-2006, 02:13 PM
Citizen Citizen is offline
 
Join Date: Sep 2005
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How can I set a session variable?

I want to make a left column for navigation that is on every page of my site.

If my registered members click a button, I want the whole column to go away.

If they close out of the window and load the forums again, I want the column to be there again. (like a php session)

How can this be accomplished?
Reply With Quote
  #2  
Old 11-19-2006, 02:19 PM
Guest190829
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Citizen View Post
I want to make a left column for navigation that is on every page of my site.

If my registered members click a button, I want the whole column to go away.

If they close out of the window and load the forums again, I want the column to be there again. (like a php session)

How can this be accomplished?
vBulletin has a special function for this called vbsetcookie():

Quote:
void vbsetcookie (string $name, [mixed $value = ''], [boolean $permanent = true], [boolean $allowsecure = true], [boolean $httponly = false])
Reply With Quote
  #3  
Old 11-19-2006, 02:22 PM
Citizen Citizen is offline
 
Join Date: Sep 2005
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Danny.VBT View Post
vBulletin has a special function for this called vbsetcookie():
What do the different attributes change?

Also, whats the easiest way to set a cookie with you want an option via button?
Reply With Quote
  #4  
Old 11-19-2006, 02:41 PM
Guest190829
Guest
 
Posts: n/a
Default

Here is something I quickly wrote (not test yet)

Plugin: Sidebar Cookie
Hook Location:
global_start

PHP Code:

PHP Code:
$show['sidebar'] = true;

if (
$_REQUEST['do'] == 'hidesidebar')
{
   
vbsetcookie('hidesidebar'1true);
}

$vbulletin->input->clean_gpc('c''hidesidebar''TYPE_INT');

if (
$vbulletin->GPC['hidesidebar'] = 1)
{
    
$show['sidebar'] = false;

The template conditional would be:

HTML Code:
<if condition="$show['sidebar']"> </if>
The button would point too:

HTML Code:
?$session[sessionurl]do=hidesidebar
Reply With Quote
  #5  
Old 11-19-2006, 02:54 PM
Citizen Citizen is offline
 
Join Date: Sep 2005
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks! Does execution order matter?

Also, do I need to change something here?

Code:
?$session[sessionurl]do=hidesidebar
Or just add make a link with this exact text:

Code:
forums/index.php?$session[sessionurl]do=hidesidebar
Reply With Quote
  #6  
Old 11-19-2006, 03:16 PM
Guest190829
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Citizen View Post
Thanks! Does execution order matter?

Also, do I need to change something here?

Code:
?$session[sessionurl]do=hidesidebar
Or just add make a link with this exact text:

Code:
forums/index.php?$session[sessionurl]do=hidesidebar
Execution should not matter, and you can do the following with the link:

{$vbulletin->options['bburl']}/index.php?$session[sessionurl]do=hidesidebar

Also I found a slight bug in the code from taking a second peak:

PHP Code:
if ($vbulletin->GPC['hidesidebar'] = 1
Should be:

PHP Code:
if ($vbulletin->GPC['hidesidebar'] == 1

Reply With Quote
  #7  
Old 11-19-2006, 03:30 PM
Citizen Citizen is offline
 
Join Date: Sep 2005
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks!

Also, what template would I need to edit to put in a global left navigation bar?
Reply With Quote
  #8  
Old 11-19-2006, 03:32 PM
Guest190829
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Citizen View Post
Thanks!

Also, what template would I need to edit to put in a global left navigation bar?
I wouldn't be able to say, depends on your style. My guess would be the navbar or header template.
Reply With Quote
  #9  
Old 11-20-2006, 05:38 AM
Citizen Citizen is offline
 
Join Date: Sep 2005
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, so I've got my sidebar in and everything shows up great.

The only problem is I cant get the sidebar to go away when I click "Remove Sidebar" at the bottom of the sidebar

http://www.gunzfactor.com/forums
Reply With Quote
  #10  
Old 03-31-2007, 06:46 PM
DiSpy's Avatar
DiSpy DiSpy is offline
 
Join Date: Feb 2007
Location: South Florida!!
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you ever get this to work? I see on your forums that you are using this code, but I have to click the hide/show text 2x for it to work.

I can't even get it to do that using the above code?!?
THANKS!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:49 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06727 seconds
  • Memory Usage 2,259KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (2)bbcode_html
  • (3)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (6)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete