Closed (fixed)
Project:
Advertisement
Version:
6.x-2.0
Component:
ad_embed module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 Jun 2009 at 20:53 UTC
Updated:
24 Aug 2009 at 17:40 UTC
I wasn't able to find anything in the issues or out on the web on this.
I need to pull in the node id of the page into the ad html in order to make the ad html display the right information. The ad html accepts and evaluates php. But when i put in something like:
if ( arg(0) == 'node' && is_numeric(arg(1)) && ! arg(2) ) {
$nid = arg(1)
}
It doesn't seem to be able to find the args. What am i missing?
thanks!
I
Comments
Comment #1
jeremy commentedWhen you say that the ad_html module evaulates PHP, I assume you have enabled an input filter to make this possible?
Have you tried just doing an "echo arg(0)" in your code to see what it's returning at this point in the code?
Comment #2
kayceedub commentedYes, input filter has been enabled to evaluate php.
echo arg(0) yields 1.
Comment #3
jeremy commentedHow about "echo $_GET['q'];"? Perhaps you'll need to emulate arg() from path.inc?
Comment #4
kayceedub commentedStill getting 1.
Comment #5
jeremy commentedWhen are you seeing this? While saving the node, or when the node is actually displayed. If $q == 1, then you're seeing this when displaying nodes, when $q is actually used to specify quantity. In this case try instead looking at $_GET['u'] -- does that give you what you need?
Comment #6
kayceedub commentedThanks! I just figured that same thing out myself.
In the ad, I put in echo $_SERVER["REQUEST_URI"]; just to see what it thinks uri was when the ad is being displayed within a node and got back:
/sites/all/modules/ad/serve.php?q=1&t=26&u=node/4230
So I tried $_GET['u'] and that works. Thanks again! Great module!
Comment #7
jeremy commentedMoving into "fixed" status so other people can easily find this issue if they're trying to do something similar. It will auto-close after 2 weeks.