Log in

View Full Version : Using phpAdsNew with the Usergroup Specific Adverts Hack


Chris_D
08-29-2005, 04:39 PM
https://vborg.vbsupport.ru/showthread.php?t=83081

Hi there, above is the Usergroup Specific Ads hack. I'm trying to get it to work with phpAdsNew so not only can I make sure that my paying users don't get ads, but also so those that don't pay get served the correct ad via phpAdsNew.

I have to display the phpAdsNew code which is the following:<?php
if (@include(getenv('DOCUMENT_ROOT').'/phpadsnew/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('zone:1', 0, '', '', '0', $phpAds_context);
echo $phpAds_raw['html'];
}
?>Unfortunately if you put this into the globaladverts template then you get the following 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 /home/website/public_html/website/forums/includes/adminfunctions_template.php(3504) : eval()'d code on line 5

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.According to hellsatan, the developer, this is because I can't have any PHP code in the template. Is there any other ways of doing it? He suggested something that didn't work, and haven't heard back from him since. Does anyone else have a solution?

Andreas
08-29-2005, 04:54 PM
Put that Code in Hook global_start (without the php-Tags).

Chris_D
08-29-2005, 04:59 PM
I think that's what hellsatan said to do. I'll try again...

What do I put in the global_adverts template though?

Andreas
08-29-2005, 05:13 PM
Don't know, as I do not know what it would be for :)

Anyway, I'd suggest to remove th echo call.
Doesn't make much sense as the output will be bufered and put into a variable anyway.

Chris_D
08-29-2005, 05:41 PM
Fixed it :D

FYI -- if anyone asks again, there's a way to generate JavaScript code instead of using PHP in phpAdsNew. Using that means you don't have to edit the hack whatsoever and just put the phpAdsNew java code into the global_adverts template. Just like you'd put the GoogleAds code in there etc.

Andreas
08-29-2005, 05:43 PM
Yep. But I prefer local invocation :)