CG-quickphp plugin question
-
Opps I realize I didn’t phrase the topic properly.
I downloaded the David Chait CG-Quickphp plugin to display a php function on a static page.
I have this code without the CG-Quickphp working fine on my main blog by placing it in my index.php.
<table width=”400″ border=”0″ align=”center” cellpadding=”0″ cellspacing=”0″ class=”news”>
<tr>
<td>What I’m reading<?php include (“http://app.feeddigest.com/digest3/MHJON8KGWD.html”); ?>
</td>
</tr>
</table>I changed it to this for my static page:
<table width=”400″ border=”0″ align=”center” cellpadding=”0″ cellspacing=”0″ class=”news”>
<tr>
<td>What I’m reading<quickphp include (“http://app.feeddigest.com/digest3/MHJON8KGWD.html”); />
</td>
</tr>
</table>You can view a sample at http://www.rawgreed.com. The static page is the news link.
Any ideas how to get CG-Quickphp working?
Thanks,
Andy
-
hmmm. that’s interesting. it should really be pretty much the same thing there… though, I’d generally have used my CG-FeedRead to process the list. 😉
I’m actually surprised it works at all in the first case. Most hosts/boxes won’t allow a cross-site include, as it’s an open attack vector for lots of hacks.
Lemme see if I get some time later today to test this locally. I thought way back when I tested with local includes of php/html…
-d
Yeah. my bad. apparently certain core PHP intrinsics like ‘include’ aren’t ‘detected’ as functions by the function_exists call. The workaround would be to add something like this to your cg-quickphp.php (which I plan to do for next release):
function quickinc($file) {
include($file);
}
Then, change your code above, replacing the ‘include’ with ‘quickinc’:
<quickphp quickinc("..."); />
I tested that, works fine for me in my current theme.
-d
It worked like a charm. Thank you David 🙂 Now if you could help invent an ad switching plugin that would be great. I’ve tried javascripts and phpadsnew an ad serving platform and while both will rotate ads, niether will allow you to show ads without conflicting with each other. I would guess that the majority of blog owners have 1-3 advertising programs running with ads in the loop and in the header.php, index.php etc. The problem is displaying ads from different advertisers violates the terms of service. Changing the ads one by one is a tedious process.
It would be a boon to have a plugin like this. Thank you for the fix again 🙂
ummm, it’s been a while, but I was pretty sure phpadsnew can run exclusion rules — or at the least inclusion rules — to keep different stuff from showing.
there are very few ToS conflicts. It may be that you can’t run Yahoo and Google ads on the same pageload. But, just use a random generator, and 50/50 pass in a flag to the ad system to tell it to only use (or exclude) one of the conflicting ad systems.
The problem with phpadsnew is that it is, in most cases, overkill for the average person. I also ran into a security issue and got slammed (it had been fixed, I just didn’t know there was an update…), so I’ve sworn it off for the time being, and back to serving ads with my own homegrown system. But I don’t care about tracking, or percentages, or… When I do care, I’ll probably either build a much simplified version of the cookie tracking system, or try one of the offshoots.
But, in general, I’m using Adsense or Linkshare or other ad system that is already tracking the majority of the info I’d want. And, in most cases, I couldn’t get the click-intercept stuff to work and wasn’t getting all click data from phpadsnew anyway. 😉
-d
Hi David,
I asked on the phpadsnew forum and the moderator responded with a reply that phpadsnew can’t restrict the ads from appearing at the same time. I tried using a few javascripts, I am guessing that’s what you mean by random generator, that were designed to switch 2 ads with a 50/50 probablility. The challenge is to load the main page you have to load a few php files, so placing the javascript on a few different php files still generates yahoo and google ads appearing at the same time, on the same pageload. I haven’t found a simple way to cycle a group of ads other than changing them manually. I was hoping phpadsnew could do it, but even if it could, I agree, it really is overkill.
Andy
I was pretty sure you could use keywords or something to create your own targeting. should be easy enough to tag google ads with ‘google’, yahoo ads with ‘yahoo’, and anything non-competitive with both. Then, IN PHP, do a random number pick, and for the rest of that pageload you use one of the two keyword-based groups… I think that’d work. No JS involved in the process, all at the targeting level in PHP…
-d
Hmm that sounds like a solution…except I don’t know any PHP. I think I understand how you proposed the solution though. The problem I see is that each ad placement has a different size. If I create a keyword based group called google and another called yahoo, use a random pick for an entire group, that solves the issue of picking one ad group over the other, but how do I make sure the correct size ad gets placed in the sidebar for instance or the header?
I think by viewing other peoples blogs they generally rotate between a set of ads from different publishers with different colors and sizes. Each time I switch an ad, I goto either Google or Yahoo and generate new code, for a different color or size, and paste it in the WP php file I want the ad to appear in.
I have an idea to give bloggers finite control over ad placement and grouping that also saves time, an admin page in WP that could save the HTML code from an advertiser with a nickname. Google HTML code for example could be saved as Adsense_Sidebar. I could save an alternate color one as Adsense_Sidebar2. I could save a Yahoo one as YPN_Sidebar. I could save a header version as YPN_Header. Then some kind of php plugin with a reference to the nickname to place the code in my blog.
Something like:
<?php CG-QuickAds (“Adsense_Sidebar”); ?>
🙂 Wishful thinking 🙂I have about 12 ads I rotate among, 3 google, 3 yahoo with 2 color variations. I use the same code everytime, but when I want to change ads, each time I have to generate new code and paste it from the advertiser to WP.
Thanks,
Andy
First, I generally put things like adsense code into individual HTML files that can be included from PHP. This also has a side benefit of being able to use plugins like CG-Inbetween (or QuickPHP!) to include them on the fly.
Second, for phpadsnew, you are already telling it a ‘zone’ for a given ad, so that it pulls properly sized content. In addition (possibly through a more ‘complex’ function call, I can’t remember), you can specify attempted keyword-match phrase. So, you can tell it zone=sidebar-tall, kw=yahoo. Zones might be sidebar-tall, sidebar-square, leaderboard, between, whatever… kw is then yahoo or google (or any other ‘competitor’). The ad system will deliver an ad that matches the keyword (thus eliminating the competitive ads from showing up on the page), AND that matches the specified zone/space/size. Should ‘just work’.
-d
First, I generally put things like adsense code into individual HTML files that can be included from PHP. This also has a side benefit of being able to use plugins like CG-Inbetween (or QuickPHP!) to include them on the fly. But, you can just as easily paste into phpadsnew (I think…) and let it manage it. The ‘CG-QuickAds’ call already exists, as phpadsnew. 😉
Second, for phpadsnew, you are already telling it a ‘zone’ for a given ad, so that it pulls properly sized content. In addition (possibly through a more ‘complex’ function call, I can’t remember), you can specify attempted keyword-match phrase. So, you can tell it zone=sidebar-tall, kw=yahoo. Zones might be sidebar-tall, sidebar-square, leaderboard, between, whatever… kw is then yahoo or google (or any other ‘competitor’). The ad system will deliver an ad that matches the keyword (thus eliminating the competitive ads from showing up on the page), AND that matches the specified zone/space/size. Should ‘just work’.
-d
Hi David,
I think I will go with the QuickPHP include method. I’ve tried the method with phpadsnew and I can eliminate competative ads from showing up but then I can’t use the rotate function so the system really is overkill. I guess the perfect system would allow you to manage the ads within WP and then let you group, rotate and manage a small number of ads. I’m still suprised that a system that seems as mature as phpadsnew can’t rotate and exclude ads based on a keyword group. It looks like phpadsnew can manage and rotate ads’s in 1 location but not multiple places, thats the real root of the problem. I actually created a zone called Sidebar and another called Header, assigned keywords to 2 ads inside each zone and the probablilty was set by default to 50/50.
I asked this in the phpadsnew forum to one of the moderators who wrote a quick start guide,
I got PAN working right off the bat after reading. Just one question. How do I restrict ads from competing advertisers from displaying at the same time? I created two campaigns with two zones, each with 2 ads, one yahoo, one google. Placing the php code on the site allows the ads to rotate, but the problem is Yahoo and Google compete, so I am not supposed to place the ads side by side.
Can you please help clarify how to do this in the Quick Start?
Here was his response,
This is a problem with competing ads that PAN does not have a fix for. Therefore, those google and yahoo ads have the chance to show up on the same page at the same time. We run both on our site and they do show up on the same page sometimes twice and sometimes three times.
I don’t want to take the chance violating the Terms of Service between Google and Yahoo so I didn’t continue to use the system.
I’ve been looking for a system or WP plugin that would allow me to group and rotate, this way I could place the php code in my WP php files or in my CG-Inbetween and not have to think about it for a while. Thanks for all the advice.
Andy
Hmmm. That wasn’t my understanding… I’d have to look at the PAN code more. Seems it should be able to start with a ‘subgroup’ based on the keyword, then rotate/distribute randomly as needed.
Here’s an alternative, quick-hack approach.
1. Do a random number pick in header.php, and based on that set a variable like $adgroup = ‘yahoo’. (or google, or whatever, depending on the number of ‘groups’ you might want).
2. Have a PHP file for a given ‘ad location’ + adgroup combo. So, yahoo-header.php, yahoo-sidebar.php, google-header.php, google-sidebar.php. Each file sets up an array of possible banner-code for that slot/location, and then uses array_rand or other function to pick which banner to display, and echoes that array entry.
3. Either in your own code do something like in the sidebar do:
include($adgroup.'-sidebar.php');
… or something like that, and/or in the main code, and/or use something like CG-Inbetween to include a file like ‘ads-header.php’, and that file would do the $adgroup based include statement itself.Just a thought.
-d
Hi David,
I think your hack would work, but I lack the php skill to implement it.
I just found a small problem with my earlier approach trying to use quickphp with the quickinc hack u posted. I’m using quickphp on a single static page and it works fine. If I try to run more than 1 instance it wont work so I can’t use it to insert html files for ads around my blog. I’m back to square one and manually inserting code.If I try to run more than 1 instance it wont work so I can’t use it to insert html files for ads around my blog.
Huh? I don’t know what that means. “more than 1 instance” of what?
Maybe you want to be using CG-Inbetween, if you are talking about auto-inserting code amongst post excerpts on an archive/cat/etc page… Not sure.
The topic ‘CG-quickphp plugin question’ is closed to new replies.