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

Reply
 
Thread Tools Display Modes
  #1  
Old 08-05-2014, 04:48 PM
MAORBARI MAORBARI is offline
 
Join Date: Sep 2008
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Register new vars in all templates

Hi,
How I register new var in all templates?

And more question:
How i can use php code on settings "Option Code"?
Thank you!
Reply With Quote
  #2  
Old 08-05-2014, 07:09 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MAORBARI View Post
Hi,
How I register new var in all templates?
I'm not sure what you mean, but there isn't really any way to register a variable to all templates. You should register a variable to the template or templates where you want to use it. It *is* possible to use any global variable from any template by using {vb:var GLOBAL.name}, but that's not something you really should be doing.
Reply With Quote
Благодарность от:
tbworld
  #3  
Old 08-05-2014, 07:12 PM
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Posts: 829
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1 I think you can't, if you find it's possible then let me know! lol

2 what you put in the option code is sorrunded by double-quotes so to use a variable you can just put this $setting[value] instead if you want to use a function then you will have to close the string in this way
PHP Code:
<b>test</b>: ".explode('-', $setting[value])."continue writing html 
and if you want to use if condition or more advanced code it's more complicated
Reply With Quote
  #4  
Old 08-05-2014, 07:34 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MAORBARI View Post
Hi,
How I register new var in all templates?

And more question:
How i can use php code on settings "Option Code"?
Thank you!
What does the variable do? We might be able to give you a better suggestion.
Reply With Quote
  #5  
Old 08-05-2014, 07:37 PM
MAORBARI MAORBARI is offline
 
Join Date: Sep 2008
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you,

I need the value of the var to be on all templates.
I know how to register him to one template:
PHP Code:
vB_Template::preRegister('header',array('bit_name' => $var)); 
but I need register him in all templates, how to do it?

Thank you.
Reply With Quote
  #6  
Old 08-05-2014, 08:20 PM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Be more concrete. Why would you need a variable available on every single template? Perhaps there is another way.
Reply With Quote
  #7  
Old 08-05-2014, 08:42 PM
MAORBARI MAORBARI is offline
 
Join Date: Sep 2008
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Because it a google adsense api code or more image directory, and more..
Reply With Quote
  #8  
Old 08-05-2014, 09:01 PM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please, if you want us to help you, you really need to be a bit more forthcoming. That sentence does not make much sense and it explains nothing. Why would you need adsense code available in every single template? What would you do with an image directory in every template? Either take the time to exactly explain what you want to do, or don't. You're the one with the question, remember? Don't make us beg to help you - chances are, we won't.
Reply With Quote
3 благодарности(ей) от:
ozzy47, Paul M, tbworld
  #9  
Old 08-05-2014, 10:36 PM
MAORBARI MAORBARI is offline
 
Join Date: Sep 2008
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cellarius View Post
Please, if you want us to help you, you really need to be a bit more forthcoming. That sentence does not make much sense and it explains nothing. Why would you need adsense code available in every single template? What would you do with an image directory in every template? Either take the time to exactly explain what you want to do, or don't. You're the one with the question, remember? Don't make us beg to help you - chances are, we won't.
I dont know english very much, it is very hard to explain it.
I create new style, i put all my images in other images directory thats called "new_images".
Some images have the old directory that calles "images" (Default vbulletin directory) and the others on "new_images".
So I put a lot of images from "new_images" in many templates.
Now, I open in settings a new setting, and put the name of directory because if I want change the directory name on future, it will be easy. and now I want to use this setting on templates without register each template.

Thank you!
Reply With Quote
  #10  
Old 08-06-2014, 01:04 AM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Your English is fine, and thank you. In the ACP (Admin control Panel) in debug mode (you must be in debug mode), you can create a new ACP "options" setting. If you do not know how to do this, I will try to find you a tutorial. It should be easy enough to search for one.

Create a new setting in ACP options: "acp_imagepath". It will be automatically appended to "$vBulletin->options", you will then be able to access this "acp_imagepath" variable in all your templates.

In your templates:
Code:
  {vb:raw vboptions.acp_imagepath}/  <!-- rest of your path or image -->
In summary: "vboptions" is available to all templates and is already pre-registered, whether it should be is another question.

This is only one method of many. It was chosen because it best fits your criteria.
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:40 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.05785 seconds
  • Memory Usage 2,261KB
  • 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
  • (1)bbcode_code
  • (2)bbcode_php
  • (3)bbcode_quote
  • (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
  • (4)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete