vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [HOW TO - vB4] Rendering templates and registering variables - a short guide (https://vborg.vbsupport.ru/showthread.php?t=228078)

bobster65 11-17-2009 05:44 PM

Just wanted to thank you for this article.. I had been messing around on my own for a few hours on two of my mods that involved FORUMHOME and after reading your article (specially the last part) both my mods are now up and running smoothly on vb4 !!

CHEERS to Cellarius!

Jeweetog 11-17-2009 06:15 PM

Quote:

Originally Posted by cellarius (Post 1916047)
Sorry for being honest, but this is not how it works and it is quite obvious that you do not know what you are doing.

Of course "something" has to be done, but I do not know that mod, and therefore can not tell you what exactly will have to be done to make it vB4 compatible. It's not like there is a file in every mod that needs tampering that could be pointed out to you, where you do some mechanical search and replace and everything is fine. That's just not how it works, and this thread is not about updating the particular mod you are so interested in, but about helping coders to update their work. What has to be done is different for every single one of the hundreds of mods out there, and this article tries to provide just some of the many tools needed for that work.

The author of that mod will have to update his work, and you will have to be patient until he does - just like anyone else. If he decides not to do that you can pay someone to do it, or you can do it yourself if you have the skills. If that is not sufficient to you, you may ask in the thread for that modification, but be prepared that mod authors will be annoyed if dozens of users spam their threads with questions that go "are you not yet done", "when will you be updating this" and stuff.

Please read the announcement regarding this: https://vborg.vbsupport.ru/showthread.php?t=228073


I'm not trying to do an update. Nor am I trying to port or convert the mod to vb4. I, myself uses vb 3.8.4.

This mod has a few options. And one of the options out there tells you that if you activate 'this' option you have to add the $mgc_cb_evo_stats variable in the forumhome template.

Althought its about a particular mod, but I got the impression that this is something that is outside the scope of the mods explanation, looking at the explanation on how to do it, which is rather 'short'.

You misunderstood me, lets just leave it to that. Now if you don't mind, have a nice evening.

cellarius 11-17-2009 06:32 PM

Quote:

Originally Posted by Jeweetog (Post 1916081)
I'm not trying to do an update. Nor am I trying to port or convert the mod to vb4. I, myself uses vb 3.8.4.

Then why in heaven do you post in an article that discusses vB4 programming techniques? If you need support for a mod the one and only place to go is the thread for this mod.

winstone 11-17-2009 09:38 PM

Just wanted to thank you guys both cellarius and Shadab, I've made a lot of progress on porting some major mods after reading what you have posted, I'm doing it for my own experience as I'm planning to finally make the move to vB after having the license for more than a year now lol (been running WBB2.x for ages)

hope that you guys to continue on posting more good stuff :)

rossco_2005 11-17-2009 09:45 PM

Very nice job.
I wasn't aware of pre-registering. :)
Thanks.

cellarius 11-18-2009 01:11 AM

Quote:

Originally Posted by Shadab (Post 1915830)
Not a problem!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Another note; on multidimensional arrays...
Suppose you have a nested / multidimensional array set, like:

PHP Code:

// Array declaration & assignment

$multiDim = array(
    
'level1' => array(
        
'foo'    => 'one',
        
'bar'    => 'two',
        
'baz'    => 'three',
        
'qux'    => 'four'
    
),
    
'test' => 'testval'
);

// Variable Registration

vB_Template::preRegister(
    
'header', array('multiDim' => $multiDim)
); 

You can chain the array 'keys' like in the second example:

HTML Code:

{vb:raw multiDim.test} <!-- Output: testval -->
{vb:raw multiDim.level1.baz} <!-- Output: three -->


I have extended my example to provide for multidimensional arrays. Thanks for pointing this out :)

testebr 11-18-2009 09:52 AM

Can you give us a simple example of how to insert code to footer without fech from other template?

cellarius 11-18-2009 11:00 AM

Try to insert $my_insertvar
PHP Code:

vB_Template::preRegister('footer',array('my_insertvar ' => $my_insertvar)); 

and call {vb:raw my_insertvar}.

testebr 11-18-2009 06:17 PM

hi cellarius, I don't want to call the var manually, I just want to inject code like my old example for 3.x:

hook: parse_templates

code: $vbulletin->templatecache['footer'] .= 'text added to footer';

Capiche?

cellarius 11-18-2009 06:23 PM

Nope, that does not work. You would need to do a str_replace on something you know is there.


All times are GMT. The time now is 03:29 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.02021 seconds
  • Memory Usage 1,749KB
  • 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_html_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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