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)

TheInsaneManiac 02-06-2011 04:16 AM

Quote:

Originally Posted by ckgreenman (Post 2031248)
Hello, I hope someone can point in the right direction. I'm trying to port a mod to vb4 which has a number of templates. The php file contains a whole bunch of
Code:

eval('$template .= "' . fetch_template('templatename') . '";');
lines. The mod uses a main template which then calls the other templates from within the main template using $template references to the other templates.

I've tried a number of different iterations form the first post but I can't get anything but the main template to render. How does one go about making something like this work?


thanks.

Im wondering the same thing.

wonderfulwat 03-05-2011 07:07 AM

I've created a custom template "memberaction_dropdown_one" which I want to have show up in another custom template "postbit1".

Please help show me how to declare this. If anyone has skype it would be very much appreciated if you could walk me through the process in realtime (probably 5 min max). Send me a PM.

brandondrury 03-07-2011 08:03 PM

Just out of curiosity, is there any reason why this wouldn't work in vB 4.1.1? I'm getting some unexpected errors and wanted to rule out that element before I dig TOO deep.

Brandon

cellarius 03-11-2011 03:50 PM

Quote:

Originally Posted by brandondrury (Post 2170667)
Just out of curiosity, is there any reason why this wouldn't work in vB 4.1.1?

No, none that I'm aware of. This is pretty basic vB4 architecture, and nothing did change there.

Phaedrus 03-18-2011 07:51 AM

This is where one of those "thank you" mods would come in handy. This was a lifesaver, I was able to upgrade a mod that I needed for any upgrade.

ninadbe 03-23-2011 04:47 PM

Is there any way to make plugin that uses remote database connection or use to extract data from other server?
We have vbulletin forum for our site, but our site is located on one server and forum located on another server in order to avoid load.
I want to extract data from main site (which is located on another server) and display it on forum.

I tried lot , searched everywhere. But I not found any specific plugin / mod.

I created custom plugin on my own but it giving errors like
"MySql client ran out of memory"
"Invalid key error"

cellarius 03-23-2011 05:44 PM

This is question has nothing to do with the article this discussion thread is for. Please open your own thread in an appropriate forum.

TalkVirginia 04-01-2011 06:29 AM

I'm trying to capture a rendered/parsed template to a variable like so:

PHP Code:


$templater 
vB_Template::create('test');
$templater->register('userid'$userid);
$templater->register('bbtitle'$bbtitle);
$templater->register('homeurl'$homeurl);
$templater->register('forumurl'$forumurl);
$myvar $templater->render(); 

echo 
$myvar

I would expect that myvar would contain the parsed template, but it comes up empty.

Can anyone help me?

gibigbig 04-02-2011 05:48 AM

using in a mod:

1) make a new plugin
Hook: global_start
code:
PHP Code:

$template_hook['footer_javascript'] .= '<b>HTML goes here</b>'

spent a good few hours looking for how to do such a simple task this article has way over complicated.
also, tested and working in vb 4.1.2


also note that you can even make your own hook by using the code:
HTML Code:

{vb:raw template_hook.hook_name}
in any template
simple stuff.

cellarius 04-02-2011 06:05 AM

Quote:

Originally Posted by gibigbig (Post 2180012)
using in a mod:

1) make a new plugin
Hook: global_start
code:
PHP Code:

$template_hook['footer_javascript'] .= '<b>HTML goes here</b>'

spent a good few hours looking for how to do such a simple task this article has way over complicated.
also, tested and working in vb 4.1.2

Sorry that my article turned out to be too complicated for you. If you don't want to render a template, it may have not been made for you. Anyway - leave the template rendering aside, and you have exactly your line of code at the end of the code that covers template hooks.

By the way: hook global_start is not a good choice. It does not exist in the CMS and will vanish from any part of the product that gets rewritten to the OOP framework in future.


All times are GMT. The time now is 07:06 AM.

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.01820 seconds
  • Memory Usage 1,753KB
  • 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_code_printable
  • (1)bbcode_html_printable
  • (3)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)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