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)

Muller2 02-23-2010 09:43 PM

cellarius & moonray - you are both stars!!! :D

Thanks you!

Al

moonray 02-24-2010 12:41 AM

FINAL WORKING CODE:

Product: vBulletin
Title: Insert Simple PHP
Execution order: 5
Hook Location: global_start
PHP code:
Code:

ob_start();
include('simple.php');
$simple_php = ob_get_contents();
ob_end_clean();

vB_Template::preRegister('navbar',array('simple_php' => $simple_php));

Plugin is active: Yes

Now, go to the NAVBAR template and insert
Code:

{vb:raw insert_simple_php}
just under the code
Code:

{vb:raw ad_location.global_below_navbar}

TalkVirginia 02-25-2010 12:12 PM

I'm hoping someone can help me.. I'm having trouble displaying Openx Ads in various locations. For example in the header template.

This is the php code that Openx generates:
PHP Code:


//<!--/* OpenX Local Mode Tag v2.8.4 */-->

// The MAX_PATH below should point to the base of your OpenX installation
define('MAX_PATH''path/to/openx');

if (@include_once(
MAX_PATH '/www/delivery/alocal.php')) 
{

    if (!isset(
$phpAds_context)) 
    {
        
$phpAds_context = array();
    }

    
$phpAds_raw view_local(''100'_blank'$forumid'0'$phpAds_context'');

                echo 
$phpAds_raw[html];


This is the code I'm trying to use:

PHP Code:


//<!--/* OpenX Local Mode Tag v2.8.4 */-->

// The MAX_PATH below should point to the base of your OpenX installation
define('MAX_PATH''/path/to/openx');

if (@include_once(
MAX_PATH '/www/delivery/alocal.php')) 
{
                
ob_start();

    if (!isset(
$phpAds_context)) 
    {
        
$phpAds_context = array();
    }

    
$phpAds_raw view_local(''100'_blank'$forumid'0'$phpAds_context'');

    
$templater vB_Template::create('ad_global_header2');

                
$templater->register('phpAds_raw'$phpAds_raw);

                
$templatevalues['phpAds_raw'] = ob_get_contents();

                
ob_end_clean();

                
vB_Template::preRegister('header'$templatevalues);




TalkVirginia 02-26-2010 03:25 PM

No comments on my last post?

wajones 02-28-2010 08:02 AM

This is what I'm using.
PHP Code:

ob_start();

if (include(
'ads/phpadsnew.inc.php')) {
        if (!isset(
$phpAds_context)) $phpAds_context = array();
        
$sponsor view_raw ('6'7'_blank''''0'$phpAds_context); 
       
    }

ob_end_clean();
vB_Template::preRegister('navbar',array(
'sponsor' => $sponsor)); 


TalkVirginia 02-28-2010 04:24 PM

Thank you very much WAJones!! That works great! :D :up: :up: :up:

masterross 03-01-2010 07:49 PM

Guys help me to update this hack to vB 4
https://vborg.vbsupport.ru/misc.php?...t_post_only_37

I cant show the message "register...." to guests:

PHP Code:

if ($show['guest'] AND $forum['gfpo_enabled'])
{
    eval(
'$postbit = "' fetch_template('postbit_gfpo') . '";');
    eval(
'$postbits .= "' fetch_template('postbit_wrapper') . '";');



Michael Biddle 03-01-2010 09:03 PM

Great article!

I have a question. In vB3, you could do this:

PHP Code:

$template_hook['navbar_buttons_left'] .= '<td class="vbmenu_control"><a href="index.php">Home Page</a></td>'

Is it possible to just have the html in the plugin, or does it need to be in its own template in vb4?

masterross 03-01-2010 09:49 PM

Quote:

Originally Posted by Michael Biddle (Post 1994751)
Great article!

I have a question. In vB3, you could do this:

PHP Code:

$template_hook['navbar_buttons_left'] .= '<td class=&quot;vbmenu_control&quot;><a href=&quot;index.php&quot;>Home Page</a></td>'

Is it possible to just have the html in the plugin, or does it need to be in its own template in vb4?

It's absolutely the same in vB 4 only hooks are different.

TalkVirginia 03-03-2010 09:34 PM

I'm trying to append some text to the end of the footer.. in a plugin.. but I'm totally lost.

How do I get the footer out of the cache to append some text to it?


All times are GMT. The time now is 03:46 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.02403 seconds
  • Memory Usage 1,761KB
  • 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
  • (3)bbcode_code_printable
  • (6)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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