PDA


View Full Version : phpAdsNew


BRC2
06-08-2005, 05:11 AM
I am attempting to create a phpAdsNew module for my site, but can't seem to get it working. Below is what I've tried...
1. Generated the PHP Invocation Code from phpAdsNew. Saved this as a PHP file and uploaded to my modules folder.
<?php
if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('zone:3', 0, 'blank', '', '0', $phpAds_context);
$phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']);
$phpAds_context[] = array('!=' => 'campaignid:'.$phpAds_raw['campaignid']);
}

// Assign the $phpAds_raw['html'] variable to your template
// echo $phpAds_raw['html'];
?>

2. Created a New Module [PHP File Type] and linked to the previously created PHP file.

3. Added the new module to the home page.

If I do not 'Clean The Output File' nothing shows up.
If I do 'Clean The Output File' the header shows, but no content.

I have read through the various 'adding PHP scripts to your CMPS' threads, but have not been successful.

Thank,
Brian

mfarmerhi
06-08-2005, 05:34 AM
It's much easier adding phpAdsNew banners via javascript invocation; including being able to add a different banner in each forum...

Brian
06-08-2005, 11:17 AM
'/ads/phpadsnew.inc.php'

Try changing that to the full path to the file.

BRC2
06-08-2005, 07:17 PM
Thanks for the suggestion Brian....here's an update and a little more info about my config.

First I tried using the full path for the PHP file location. I also tried using the URL...neither worked.

What I forgot to mention in my first post was that I am successfully running the PHP Invocation Code on my forum pages and gallery page by adding the invocation code to my phpinclude_start template.

Here is how I got the banners working on my forum and CMPS pages based upon the instructions provided by Michael Morris's post at vB.org...HERE (http://www.vbulletin.org/forum/showthread.php?t=75475&page=1). I am far from a programmer, but it accomplished what I needed it to do.

1. Added the PHP Invocation code for both zones to my phpinclude_start template... I'm sure this could be optimized, but it does work. Notice on the second invocation I added "2" after $phpAds_raw and $phpAds_context.
if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('zone:1', 0, 'blank', '', '0', $phpAds_context);
$phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']);
$phpAds_context[] = array('!=' => 'campaignid:'.$phpAds_raw['campaignid']);
}

// Assign the $phpAds_raw['html'] variable to your template
// echo $phpAds_raw['html'];


if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
if (!isset($phpAds_context2)) $phpAds_context2 = array();
$phpAds_raw2 = view_raw ('zone:3', 0, 'blank', '', '0', $phpAds_context2);
$phpAds_context2[] = array('!=' => 'bannerid:'.$phpAds_raw2['bannerid']);
$phpAds_context2[] = array('!=' => 'campaignid:'.$phpAds_raw2['campaignid']);
}

// Assign the $phpAds_raw['html'] variable to your template
// echo $phpAds_raw['html'];
2. I then added the following to my header template and my CMPS template
$phpAds_raw[html] for the first invocation code
$phpAds_raw2[html] for the seconde invocation code

3. To show the ad in my forum pages, but not my CMPS pages I added the following contion.
<if condition="THIS_SCRIPT != 'adv_index'"></if>

Thanks,
Brian

theMusicMan
06-09-2005, 07:52 PM
Forgive me here if I have missed the point, but why don't you just create a new module and put the invocation code generated by phpAdsnew in that...? This is what I do for a graphic banner and for text ads... works fine...!!!

J

BRC2
06-09-2005, 09:13 PM
John,
I tried creating a new module using a php file with nothing but the invocation code from phpadsnew, but the banners would not show, only the header for the module.

Brian

Brian
06-09-2005, 09:14 PM
If you're using the invocation code then you would need to create that as a template module, not a PHP module.

BRC2
06-09-2005, 09:35 PM
Ok, this seems to be getting overly complicated or confusing :confused: ? My understanding from reading other posts was that you could not insert PHP code into templates, thus you needed to create a php file in your modules directory and link to it...thus my steps in the first post. Am I incorrect? I tried pasting the PHP invocation in, via Add Module [Template] type per the previous posts instructions, but still nothing. Maybe I'm not seeing the entire picture from your posts or our information is conflicting :confused: .

Brian

ConqSoft
06-09-2005, 09:39 PM
You need to have the PHP code in a PHP file, and have that dump into a variable name that you can then use in a template.

theMusicMan
06-10-2005, 04:24 AM
All I did was to create a template module and insert the invocation code from phpAdsNew into it. I also added a title row and some css row stuff for consistency in look/feel. That does work, you don't need to do anything with PHP for this...

J

BRC2
06-14-2005, 11:31 PM
Ok...I figured it out. The problem was that I was telling phpAdsNew to generate the code for a template, thus the it was not including the last two lines. After getting the right code, I simply saved it as a PHP file in my Modules folder. Then created a new module by linking to it. Thanks for everyone's input!

Before (Wrong for PHP Module)
<?php
if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('zone:3', 0, 'blank', '', '0', $phpAds_context);
$phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']);
$phpAds_context[] = array('!=' => 'campaignid:'.$phpAds_raw['campaignid']);
}

// Assign the $phpAds_raw['html'] variable to your template
// echo $phpAds_raw['html'];
?>

Correct (For PHP Module)...also includes table info
<tr>
<td class="alt1">
<?php
if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('zone:3', 0, '', '', '0', $phpAds_context);
$phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']);
$phpAds_context[] = array('!=' => 'campaignid:'.$phpAds_raw['campaignid']);
echo $phpAds_raw['html'];
}
?>
</tr>
</td>

<tr>
<td class="alt1">
<?php
if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('zone:3', 0, '', '', '0', $phpAds_context);
$phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']);
$phpAds_context[] = array('!=' => 'campaignid:'.$phpAds_raw['campaignid']);
echo $phpAds_raw['html'];
}
?>
</tr>
</td>

Brian

MortysTW
06-18-2005, 02:08 PM
Brian,

I'm totally confused here. Did you have to create a template file to go along with this? If so, what the heck did it look like. I'm totally not understanding how to create a module that will display php includes. I understand how the stock modules are working since they are just scripts and in conjunction witht he templates they perform the visual output. But when not doing a script, and just wanting to put php into a module and then calling it on the front page, I seem to get errors. I sure wish I new this stuff better. :(

Here's my phpAdsnew snippit

<?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'];
}
?>


And I've created a module file and dumped in the proper modules directory, and basically my module file has a table in it and in one of the cells, I am trying to call out the phpadsnew.


<td scope="col"><div align="center"><span class="genmed">
<?php
if (@include(getenv('DOCUMENT_ROOT').'/phpAdsNew/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('zone:2', 0, '', '', '0', $phpAds_context);
echo $phpAds_raw['html'];
}
?>
</span></div></td>


But to me, it seems like I should be creating a template file somehow. Like put all the table and cell coding in a template and just have a simple "$tag-caller" in that template file that goes and tells the module to visually display a result.

I'm feeling dumber the more I type now. Losing whatever I thought I understood the more I type.

Can somebody enlighten me. I've read the create a module instructions that people keep linking to and the developer tools instructions too, but there is just some simple little thing that I know I'm not catching that will get this to all make perfect sense. :confused:

wolf314
06-18-2005, 04:43 PM
I know the vBadvanced website has it's own working banner on every page (via phpadsnew?), but the only place the banners show on my site is in the Forums and not on the main page.

Is there another template besides headers and php_includes to make a change to for the main page to show the banners using phpadsnew?

mholtum
06-18-2005, 04:55 PM
I know the vBadvanced website has it's own working banner on every page (via phpadsnew?), but the only place the banners show on my site is in the Forums and not on the main page.

Is there another template besides headers and php_includes to make a change to for the main page to show the banners using phpadsnew?Forumhome maybe? ;)

wolf314
06-18-2005, 07:55 PM
I've looked in that, but that seems to be coded correctly by calling the $header variable. Also, adv_portal calls the $header variable but it seems to missed the variable $phpAds_raw set in the phpinclude_start template.

theMusicMan
06-19-2005, 04:55 AM
Why not use "Remote Invocation for javascript" as the invocation code, and simply include that code generated by phpAdsnew in a template module...? So much easier than playing with php...

wolf314
06-19-2005, 10:18 AM
Why not use "Remote Invocation for javascript" as the invocation code, and simply include that code generated by phpAdsnew in a template module...? So much easier than playing with php...

Actually, I tried that first. The results were the same. Funny thing is I never knew either (PHP or Javascript) was working at all until I went to another page besides the Home Page.

I'm not that good with PHP or Javascript, but I actually understand PHP more. I was thinking of putting the PHP invocation code variable into PHP globals and see if maybe that worked. Not like I really know what I'm talking about... :rolleyes:

wolf314
07-09-2005, 02:47 AM
Found out what was going on that caused the banner not to show up on the HOME page and thought it worth sharing.

Quite simply it was the wrong template! For the vBadvanced settings I did not choose the vBulletin template with the vBulletin.org mods that were needed.

Funny how a little extra sleep can help sometimes.

Masiello
12-22-2005, 12:35 PM
Just copy the code generated in Javascript Remote invocation and add as Module Template it works great and fine, but I have a question, what i do to show banners in header home to the right page on The logo level?