vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   eval $vbulletin->templatecache not working! (https://vborg.vbsupport.ru/showthread.php?t=221725)

al3bed 08-25-2009 12:52 PM

eval $vbulletin->templatecache not working!
 
hi,

I have a problem but I don't know where exactly?

look at the code please

PHP Code:

$ain_adsense_info $vbulletin->db->query_read("
                    SELECT id, type, content, channel, slot, width, height
                    FROM " 
TABLE_PREFIX "ainadsense AS ainadsense
                    ORDER BY id ASC
                "
);
                
                while (
$ainadsense $db->fetch_array($ain_adsense_info))
                {
                    
exec_switch_bg();
                    eval(
'$ain_adsense_bit .= "' $vbulletin->templatecache['ain_adsense_manager_bit'] . '";');
                } 


the template 'ain_adsense_manager_bit' will take data and show it in home template
but my problem is that $ain_adsense_bit not working inside any template!

and the table is not empty

Lynne 08-25-2009 01:41 PM

Variables get called in different ways depending on the hook location. Find your hook in the code. Look at the code above it to see how the variables are being called. You may not using the correct variable syntax.

al3bed 08-25-2009 03:21 PM

i use misc_start hook .. it's look like:

PHP Code:

if ($_REQUEST['do'] == 'mypage') {

/* my code here */



so if i enter: misc.php?do=mypage it's will show my code

my code is like forumbit code but not working

i mean only the part of the loop:
eval('$ain_adsense_bit .= "' . $vbulletin->templatecache['ain_adsense_manager_bit'] . '";');

Lynne 08-25-2009 04:29 PM

That isn't normally the way you would eval a template.

PHP Code:

eval('$ain_adsense_bit .= "' fetch_template('template_name_here') . '";'); 


al3bed 08-25-2009 04:46 PM

what is your way?

Lynne 08-25-2009 05:01 PM

I posted it.

al3bed 08-25-2009 07:33 PM

oh sorry i don't notice that ..

fetch_template work great .. thanks

but why $vbulletin->templatecache not working for me .. it's work before!

Lynne 08-25-2009 07:51 PM

I've only ever used $vbulletin->templatecache to access a template that is cached and do something like a str_replace in it. I don't know how you have used it before, so I can't comment on why it worked before and not now.


All times are GMT. The time now is 12:14 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.02825 seconds
  • Memory Usage 1,724KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete