Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-22-2005, 07:26 PM
Darwix Darwix is offline
 
Join Date: Nov 2005
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 12-23-2005, 05:00 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The error probably means that you forgot a quote somewhere. Impossible to help more without seeing the actual code.
Reply With Quote
  #3  
Old 12-23-2005, 10:57 PM
Darwix Darwix is offline
 
Join Date: Nov 2005
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'];
    }
?>
Reply With Quote
  #4  
Old 12-24-2005, 12:05 AM
Andrew's Avatar
Andrew Andrew is offline
 
Join Date: Nov 2004
Location: Pennsylvania
Posts: 441
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'];
    }
?>
Reply With Quote
  #5  
Old 12-25-2005, 11:40 PM
Darwix Darwix is offline
 
Join Date: Nov 2005
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Andrew, unfortunately it didn't work. It's the same error as before.
Reply With Quote
  #6  
Old 12-26-2005, 01:08 AM
Andrew's Avatar
Andrew Andrew is offline
 
Join Date: Nov 2004
Location: Pennsylvania
Posts: 441
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 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>
Reply With Quote
  #7  
Old 12-31-2005, 08:42 PM
R34GTT R34GTT is offline
 
Join Date: Dec 2005
Location: UK
Posts: 72
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for the above! I have now finally got my banner working!
Reply With Quote
  #8  
Old 11-10-2006, 05:02 AM
imported_infitech's Avatar
imported_infitech imported_infitech is offline
 
Join Date: Apr 2004
Location: Queens, NY
Posts: 247
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

You can't put PHP directly into the templates 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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:40 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.05991 seconds
  • Memory Usage 2,250KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_html
  • (4)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete