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

Reply
 
Thread Tools Display Modes
  #1  
Old 12-09-2008, 07:44 AM
saveriop saveriop is offline
 
Join Date: Dec 2008
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Exporting variable from plugin to template

Hi,
I need just to make available a new variable in my template.
If the requested url contains a custom value (a referral index), I need to add this value to profiles url.

I'm new to vbulletin programming; I need to do something like:
Code:
if ($_GET['fref']=='PS') $_SESSION['fref']='PS';

$pfer ? $_SESSION['fref'];
Then I would like to use $pref insede the template.
Reply With Quote
  #2  
Old 12-10-2008, 03:00 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where do you want the variable available for use?
Reply With Quote
  #3  
Old 12-10-2008, 05:05 AM
saveriop saveriop is offline
 
Join Date: Dec 2008
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I need the variable in template because I need to replace profile and user links (I need to integrate with drupal user base).

Thanks
Reply With Quote
  #4  
Old 12-10-2008, 07:11 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was trying to ask - which template?
Reply With Quote
  #5  
Old 12-10-2008, 07:48 AM
saveriop saveriop is offline
 
Join Date: Dec 2008
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry,

not template... style
I have custom styles to manage different sections.
May be I can just modify the phrases and variabile (with URLs) in the plugin?
Reply With Quote
  #6  
Old 12-11-2008, 03:23 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can create a plugin at global start, which will allow your variable to be used in most templates. In others, you may have to use the PHP $GLOBALS[] array to access it, or alternatively, make the variable available by creating a plugin just before the template is parsed and bring the variable into scope.
Reply With Quote
  #7  
Old 12-12-2008, 07:17 AM
saveriop saveriop is offline
 
Join Date: Dec 2008
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Dismounted,

can you guide me?
I wrote my plugin at Global Start

Code:
if ($_GET['fref']=='PS') $_SESSION['fref']='PS';

$pfer ? $_SESSION['fref'];
then I want tu use $pfer variable in the header section of my style; I have to use something like this?

Code:
$GLOBAL['pfer']
Thanks
Reply With Quote
  #8  
Old 12-12-2008, 03:14 PM
Gio~Logist's Avatar
Gio~Logist Gio~Logist is offline
 
Join Date: Jun 2004
Location: San Francisco
Posts: 2,575
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you tried just using $pfer? Once you set a variable in global_start, you should be able to use it just about anywhere.

Also, the procedure for globalizing a variable is as follows:
PHP Code:
global $var$var2$so_on$so_forth
Reply With Quote
  #9  
Old 12-17-2008, 06:33 AM
saveriop saveriop is offline
 
Join Date: Dec 2008
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Gio,

can yoiu help me to write this little piece of code?

My plugin now is (triggered at global_start):

Code:
global $fref;

if ($_GET['fref']=='PS') $_SESSION['fref']='PS';

$fref = 'foo';
In the header code of my style I have:

Code:
<a href="$fref">XXXXXXXXXXXXXX</a>
but the $fref variable is always empty...
May be I mistake something?

Thanks.
Reply With Quote
  #10  
Old 03-20-2012, 01:27 PM
pompaunpo pompaunpo is offline
 
Join Date: Nov 2006
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

but in this forum there is someone who answers and helps people?
hours that are around on this forum.
(in vb 3.x NOT 4 !!!) show variable from plugin to template !!!!

--------------- Added 20 Mar 2012 at 15:36 ---------------

Code:
global $test; $test = '<h1>hello</h1>';
this is my plugin in global_start, ok?

I want simply to see the contents of the variable $test in header template

understand?
if I put $test in header template, $test is empty

how the heck do you?


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:01 PM.


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.04447 seconds
  • Memory Usage 2,249KB
  • 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
  • (6)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete