Error message in implementing phpadsnew

carwash

Enthusiast
Joined
Apr 27, 2004
Messages
166
I tried to implement my phpadsnew code, which i successfully generated using the invocation code. My website is www.talksox.com, and I want to use phpadsnew to serve the top right ad spot (currently occupied by a second adsense box).

I have those two adsense banners set up in a table in my navigation template. When I went to replace the right one with my phpadsnew code, I get this error message:
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 /home2/wwwtalk/public_html/forum/includes/adminfunctions_template.php(3055) : eval()'d code on line 112

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 went to the adminfunctions_template.php file and looked on line 112:
Code:
		// check for copyright removal
		if ($title == 'footer' AND strpos($template, '$vbphrase[powered_by_vbulletin]') === false)
		{
			print_stop_message('you_can_not_remove_vbulletin_copyright');
		}

The line in question is the "}", which is on its own seperate line after the "you_can_not_remove_etc... line. What exactly is wrong with the php code here? I want to get phpadsnew working....

Thanks.
 

WhSox21

Fan
Joined
Nov 16, 2004
Messages
610
Code:
print_stop_message('you_can_not_remove_vbulletin_c  opyright');

Does that really have spaces in the code on your page? If so get rid of those spaces!
 

WhSox21

Fan
Joined
Nov 16, 2004
Messages
610
OK, can you copy the code here that you're trying to add? This most likely is trying to add single quotes (') in the variable names or something similar to that.

By the way, the line of code that had a problem on adminfunctions_template.php was line 3055. The line of code that you were adding that had a problem was in your template on line 112. Just for future reference! ;)
 

carwash

Enthusiast
Joined
Apr 27, 2004
Messages
166
Ohhh, ok, line 3055 from my code is:
Code:
	$oldlevel = error_reporting(E_PARSE);
		ob_start();
		eval('$devnull = "' . $template . '";');
		$errors = ob_get_contents();
		ob_end_clean();
		error_reporting($oldlevel);
		return $errors;

Line 3055 being the one that starts with "eval". The code I am trying to add is:
Code:
<?php
    if (@include(getenv('DOCUMENT_ROOT').'/adserver/phpadsnew.inc.php')) {
        if (!isset($phpAds_context)) $phpAds_context = array();
        $phpAds_raw = view_raw ('zone:2', 0, '', '', '0', $phpAds_context);
        echo $phpAds_raw['html'];
    }
?>
 

WhSox21

Fan
Joined
Nov 16, 2004
Messages
610
I've never acutally done this before but this is what I would assume you would have to do:

Put this code in php_include template:
Code:
if (@include(getenv('DOCUMENT_ROOT').'/adserver/phpadsnew.inc.php')) {
        if (!isset($phpAds_context)) $phpAds_context = array();
        $phpAds_raw = view_raw ('zone:2', 0, '', '', '0', $phpAds_context);
}

Then this code where you want to add the banner:
Code:
$phpAds_raw[html]

An alternative and what I would do personally is add that code to global.php and then just use the same way to call the banner. I'm not sure how php_include template works as I would go this route but just keep testing. I'm not sure if you need the php tags or not with it.
 

Wayne Luke

Tazmanian
Joined
Jan 6, 2004
Messages
5,791
The error isn't in the PHP code it is in your template. What did you put in the template to try and implement phpAdsNew?
 

carwash

Enthusiast
Joined
Apr 27, 2004
Messages
166
Wayne Luke said:
The error isn't in the PHP code it is in your template. What did you put in the template to try and implement phpAdsNew?
I put:
Code:
<?php
    if (@include(getenv('DOCUMENT_ROOT').'/adserver/phpadsnew.inc.php')) {
        if (!isset($phpAds_context)) $phpAds_context = array();
        $phpAds_raw = view_raw ('zone:2', 0, '', '', '0', $phpAds_context);
        echo $phpAds_raw['html'];
    }
?>
in a table. I already had two google ads in the table (as you can see on the site), and just replaced the second one with this.
 

WhSox21

Fan
Joined
Nov 16, 2004
Messages
610
Wayne Luke said:
The error isn't in the PHP code it is in your template. What did you put in the template to try and implement phpAdsNew?
Yes, that's what I tried telling him the problem was. That's why I suggested adding that php code to global.php and then rather than using echo $phpAds_raw['html']; just use the variable name where you want it to be shown at.
 

carwash

Enthusiast
Joined
Apr 27, 2004
Messages
166
I tried the global.php method and it worked, thank you very much.
 
Top