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

Reply
 
Thread Tools Display Modes
  #11  
Old 01-10-2010, 12:16 PM
solboy solboy is offline
 
Join Date: Jun 2002
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks cellarius for your reply. I think I may have to hire a programmer for this.
Reply With Quote
  #12  
Old 02-10-2010, 09:20 PM
masterross's Avatar
masterross masterross is offline
 
Join Date: Nov 2005
Location: Bulgaria
Posts: 315
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thx a lot Cellarius!

Just a little correction. Code should looks like this:

PHP Code:
$templater vB_Template::create('pb_latestthreads_area'); // create the template
    
$templater->register('pblatest_bigblocks'$pblatest_bigblocks); // register $pblatest_bigblocks to be able to use {vb:raw pblatest_bigblocks} in template pb_latestthreads_area
    
$templatevalues['pb_latestthreads_area'] = $templater->render(); // rendering template into a variable suitable for preregistering for use in existing template 
    
vB_Template::preRegister('FORUMHOME'$templatevalues); // preregister variable from line above to be able to use {vb:raw pb_latestthreads_area} on forumhome 
Reply With Quote
  #13  
Old 02-11-2010, 05:17 AM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And what should be corrected in your version of the code? The only thing you changed is the name of the variable, which you lowercased and inserted some underscores. Of course, you can name your variables whatever you want within the limits given by php. But there is no rule, not even a convention in php to use only lowercase variable names and add underscores, so why should using the camelcase variable names the original poster came up with be incorrect?
Reply With Quote
  #14  
Old 02-11-2010, 07:55 AM
masterross's Avatar
masterross masterross is offline
 
Join Date: Nov 2005
Location: Bulgaria
Posts: 315
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The var in vB_Template::create and $templatevalues should be the same and without string ($)
Reply With Quote
  #15  
Old 02-11-2010, 09:24 AM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You're correct with the $, that is indeed a typo I missed. Thanks for pointing this out. But the vars in the method call and the array do not have to be the same by any means. The first one is the name of the template that's being called, the second one the variable that can be accessed later on. It can make sense to name them the same, but that's not mandatory. In my code I was using the template names and variables the original poster was using. This was not my choice, but I stuck to it to make things not even more difficult.
Reply With Quote
  #16  
Old 02-11-2010, 02:53 PM
Sarcoth Sarcoth is offline
 
Join Date: Mar 2006
Location: Huntsville
Posts: 521
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just a note to solboy. I initially had a problem understanding the new template rendering system. I spent time going over numerous mods and over cellarius' thread on the subject. I actually keep a handy print out of that thread which I still look over often. I now feel comfort in the "new way" and it is easy to learn via trial and error. If something isn't working, register another variable. Now, it looks so simple to me...except for a couple problems I'm still having.
Reply With Quote
  #17  
Old 02-17-2010, 06:15 PM
masterross's Avatar
masterross masterross is offline
 
Join Date: Nov 2005
Location: Bulgaria
Posts: 315
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@ cellarius,

Can you help me with this?
https://vborg.vbsupport.ru/showthread.php?t=236031

I cant handle auto template editing
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 06:23 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.04292 seconds
  • Memory Usage 2,228KB
  • 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_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
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete