vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   PHP Include for ad system (https://vborg.vbsupport.ru/showthread.php?t=103554)

Darwix 12-22-2005 07:26 PM

PHP Include for ad system
 
I'm running into some problems including a banner rotation script on a forum.

If I put the advertisement code directly into the header template I get this error

Quote:

The following error occurred when attempting to evaluate this template:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/talkhome/public_html/forum/includes/adminfunctions_template.php(3537) : eval()'d code on line 43

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.
I then tried pasting the code into a file called advert.php and including it in the header, this also did not work, it was just like it wasn't there at all. I'm stuck for now and any help would be greatly appreciated.

Thanks

Marco van Herwaarden 12-23-2005 05:00 AM

The error probably means that you forgot a quote somewhere. Impossible to help more without seeing the actual code.

Darwix 12-23-2005 10:57 PM

This is the code to include the ad

PHP Code:

<?php
    
if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
        if (!isset(
$phpAds_context)) $phpAds_context = array();
        
$phpAds_raw view_raw ('zone:2'0'''''0'$phpAds_context);
        echo 
$phpAds_raw['html'];
    }
?>


Andrew 12-24-2005 12:05 AM

Try this instead:
PHP Code:

<?php
    
if ((include getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php') == 'OK')
    {
        include (
getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')
        if (!isset(
$phpAds_context)) $phpAds_context = array();
        
$phpAds_raw view_raw ('zone:2'0'''''0'$phpAds_context);
        echo 
$phpAds_raw['html'];
    }
?>


Darwix 12-25-2005 11:40 PM

Thanks Andrew, unfortunately it didn't work. It's the same error as before.

Andrew 12-26-2005 01:08 AM

Wow - I can't believe two of us missed this:
Quote:

Originally Posted by Darwix
If I put the advertisement code directly into the header template I get this error

You can't put PHP directly into the templates :D What you will need to do is create a new plugin in global_start with the following code:
PHP Code:

if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php'))
{
    if (!isset(
$phpAds_context)) $phpAds_context = array();
    
$phpAds_raw view_raw ('zone:2'0'''''0'$phpAds_context);
    
$phpAdsVerify "True";


Then add this to your header template where you want your ads to showup:
HTML Code:

<if condition="$phpAdsVerify">$phpAds_raw['html']</if>

R34GTT 12-31-2005 08:42 PM

Thank you for the above! I have now finally got my banner working!

imported_infitech 11-10-2006 05:02 AM

Quote:

Originally Posted by Andrew
Wow - I can't believe two of us missed this:

You can't put PHP directly into the templates :D What you will need to do is create a new plugin in global_start with the following code:
PHP Code:

if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php'))
{
    if (!isset(
$phpAds_context)) $phpAds_context = array();
    
$phpAds_raw view_raw ('zone:2'0'''''0'$phpAds_context);
    
$phpAdsVerify "True";


Then add this to your header template where you want your ads to showup:
HTML Code:

<if condition="$phpAdsVerify">$phpAds_raw['html']</if>

im getting
Code:

The following error occurred when attempting to evaluate this template:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/infitech/public_html/forums/includes/adminfunctions_template.php(3593) : eval()'d code on line 6

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.



All times are GMT. The time now is 12: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.01309 seconds
  • Memory Usage 1,745KB
  • 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
  • (2)bbcode_html_printable
  • (4)bbcode_php_printable
  • (3)bbcode_quote_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