vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Code help (https://vborg.vbsupport.ru/showthread.php?t=232657)

solboy 01-10-2010 12:16 PM

Thanks cellarius for your reply. I think I may have to hire a programmer for this.

masterross 02-10-2010 09:20 PM

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 


cellarius 02-11-2010 05:17 AM

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?

masterross 02-11-2010 07:55 AM

The var in vB_Template::create and $templatevalues should be the same and without string ($)

cellarius 02-11-2010 09:24 AM

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.

Sarcoth 02-11-2010 02:53 PM

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. :)

masterross 02-17-2010 06:15 PM

@ cellarius,

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

I cant handle auto template editing :(


All times are GMT. The time now is 04:27 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.01000 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete