PDA

View Full Version : Trying to figure out correct syntax


RetroDreams
03-07-2008, 02:05 PM
I've got an old phpAds setup that has always worked well so I've stuck with it throughtout phpAds progression to OpenAds and now to OpenX. Anyhow, I've never tried to put an ad into the postbit but I'd now like to do so for guests -- and for more information I use the legacy postbit.

Generally, I just throw $phpAds_raw[html] where I want the ad to show up and move on. However, I threw it into the postbit_legacy template and it just comes up blank. In using the search engine, I've found that you need to use $GLOBALS[] when using postbit_legacy, however, I cannot seem to figure out the correct syntax to get the ad to appear.

$GLOBALS[phpAds_raw] returns "Array" but it needs to have that [html] on the end in order to serve the ad. Is there a way to double bracket? Does anyone have any insight on this?

Opserty
03-07-2008, 02:11 PM
$GLOBALS[phpAds_raw4][html]

RetroDreams
03-07-2008, 02:13 PM
Tried it... it just returns Array[html]

--------------- Added 1204910490 at 1204910490 ---------------

Disregard... I've figured it out.

I created a new plugin at postbit_display_complete and entered global $phpAds_raw4; into it. Doing so allowed me to use my standard $phpAds_raw4[html] verbage in the template.

Opserty
03-07-2008, 03:46 PM
Oh whoops you could try:

{$GLOBALS[phpAds_raw4][html]}
// Note the braces surrounding it

Dismounted
03-08-2008, 03:21 AM
In templates, you can only use one level of addressing arrays. To get around it, you need to use braces (which Opserty has posted as a fix).

Blackhat
06-09-2008, 11:00 PM
I cant get this to work. Im using this in a plugin


// The MAX_PATH below should point to the base of your OpenX installation
define('MAX_PATH', '/*****/*****/*****/html/ads');
if (@include_once(MAX_PATH . '/www/delivery/alocal.php')) {
if (!isset($phpAds_context)) {
$phpAds_context = array();
}
$phpAds_raw = view_local('', 12, 0, 0, '', '', '0', $phpAds_context);

}


and try to call it as posted above, but it only prints the [html] part as text

Opserty
06-10-2008, 06:53 AM
It could be do with the script, you should test the output separately as well.

Try:

// The MAX_PATH below should point to the base of your OpenX installation
define('MAX_PATH', '/*****/*****/*****/html/ads');
if (@include_once(MAX_PATH . '/www/delivery/alocal.php'))
{
if (!isset($phpAds_context))
{
$phpAds_context = array();
}
$phpAds_raw = view_local('', 12, 0, 0, '', '', '0', $phpAds_context);
$phpAdsHTML =& $phpAds_raw['html'];
}


And use $GLOBALS[phpAdsHTML] in your template. If that doesn't work, try doing a var_dump() of the phpAds variable and seeing what output there is.