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 12-26-2009, 06:02 PM
BBR-APBT's Avatar
BBR-APBT BBR-APBT is offline
 
Join Date: Feb 2009
Location: Maryland
Posts: 946
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default What was the point in making us register variables?

What was the point in making us register variables?

To me it is nothing but a pain in the rear end.

When you want to register a variable to pull in your template you have to register it in every template that is around yours.

For instance I am trying to use
Code:
{vb:raw modcpdir}
I have to register it in my template and preregister 3 other templates to get it to show on the postbit_legacy template and it still don't want to show.

Why should it be that stupid. That is tons of extra code we shouldn't have to type.

I remember when you could just use
Code:
$modcpdir
I don't mind typing
Code:
{vb:raw modcpdir}
But for me to have to type
Code:
    $templater->register('modcpdir', $modcpdir);
and
Code:
vB_Template::preRegister('showthread',array('modcpdir' => $modcpdir));
vB_Template::preRegister('postbit_legacy',array('modcpdir' => $modcpdir));
and so on for each template that wraps around mine.

Just to return $modcpdir is totally insane.
Reply With Quote
  #2  
Old 12-26-2009, 08:04 PM
DavidsMods DavidsMods is offline
 
Join Date: Oct 2009
Posts: 134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think the reasons for it is security.
Reply With Quote
  #3  
Old 12-26-2009, 10:12 PM
consolegaming consolegaming is offline
 
Join Date: Jan 2007
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nah as far as I know you don't have to register it for the outer templates. You just pre-register variables when you need to use the variable inside of that template. You don't need to go through it's hierarchy registering it for each parent template.

For example I had to pre-register my custom header template for the 'header' template. Then any custom variables I wanted to use inside my custom template I just registered directly for that. I didn't have to register them for the 'header' template too.

The thing I did find though which seemed senseless to me is that if you register your variables for the same custom template in more than one place for example I registered the code for an avatar in one plugin and the rest of my variables in another plugin. Then I found that I needed to re-register those variables. i.e. I found that because I had called the create/render lines for my template again it had unregistered the variables I had already registered. Now that certainly confused me lol.
Reply With Quote
  #4  
Old 12-02-2010, 01:07 AM
gibigbig gibigbig is offline
 
Join Date: Jul 2007
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I preregister them in my global.php file

that way you wont have to add that line to a million files

be warned though, some actions dont include the global.php
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 02:15 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.03644 seconds
  • Memory Usage 2,190KB
  • 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
  • (5)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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