Undefined variable: adHTML


Posted on 16th Feb 2014 07:03 pm by admin

Hello:

While checking my site error logs, I've noticed one repetitive error that fills the log file. The error is "PHP Notice: Undefined variable: adHTML in /.../bot_jrheader.php on line 61". The code does what it's intended to do, and this error has existed nearly a year, but it's probably time to clean up the code and minimize the log file growth. I'm a novice at coding, but have a grasp of the the absolute basics. Any assistance would be appreciated.

Line 61 is "$adHTML .= $adHTML_1;"
The entire file consists of the following code:

<?php
defined('_VALID_MOS') or die('Direct Access to this location is not allowed.') ;
$_MAMBOTS->registerFunction('onPrepareContent', 'head') ;
function head($published, &$row, &$mosParams, $page=0)
{
global $database, $mosConfig_live_site, $params;
$linksSuffix = '' ;
$query = "SELECT id FROM #__mambots WHERE element = 'bot_jrheader' AND folder = 'content'";
$database->setQuery( $query );
$id = $database->loadResult();
$mambot = new mosMambot( $database );
$mambot->load( $id );
$params =& new mosParameters( $mambot->params );
$rotate=$params->get('ad_rotate');
if ($rotate==1 ) {$rotate="true";}
else {$rotate="false";}
$adHTML_1 = "<script type="text/javascript">rn"
. "<!--rn"
. "ad_ext_path = "" . $params->get('ad_ext_path') . ""; rn"
. "ad_partner = "" . $params->get('ad_partner') . ""; rn"
. "ad_width = "" . $params->get('ad_width') . ""; rn"
. "ad_height = "" . $params->get('ad_height') . ""; rn"
. "ad_max_stores = "" . $params->get('ad_max_stores') . ""; rn"
. "ad_shrink_iframe = "" . $params->get('ad_shrink_iframe') . ""; rn"
. "ad_expand_iframe = "" . $params->get('ad_expand_iframe') . ""; rn"
. "ad_style = "" . $params->get('ad_style') . ""; rn"
. "ad_topcat_id = "" . $params->get('ad_topcat_id') . ""; rn"
. "ad_prefer_multiple = "" . $params->get('ad_prefer_multiple') . ""; rn"
. "ad_channel = "" . $params->get('ad_channel') . ""; rn"
. "ad_transparent = "" . $params->get('ad_transparent') . ""; rn"
. "ad_rotate = "" . $rotate . ""; rn"
. "ad_target = "" . $params->get('ad_target') . ""; rn"
. "ad_alternate_color = "" . $params->get('ad_alternate_color') . ""; rn"
. "ad_alternate_url = "" . $params->get('ad_alternate_url') . ""; rn";
$adHTML_3 = "//--> rn"
. "</script>rn"
. "<script src="http://ads.justrelevant.com/show_ad.js" type="text/javascript"></script>rn";
$regex = "/{(Mosjrheader)s*(.*?)}/i" ;
$GLOBALS['botNewadHTML1'] = $adHTML_1 ;
$GLOBALS['botNewadHTML3'] = $adHTML_3 ;
$GLOBALS['botMosjrheaderKeywords'] = $params->get('ad_keywords') ;
$row->text = preg_replace_callback( $regex, 'botMosjrheader_replacer', $row->text );
unset($GLOBALS['botNewadHTML1']);
unset($GLOBALS['botNewadHTML3']);
unset($GLOBALS['botMosjrheaderKeywords']);
return true ;
}
function botMosjrheader_replacer( &$matches ) {
global $params;
$NewadParams = explode("|", $matches[2]) ;
if (sizeof($NewadParams) > 0) {
$mykeyword= $NewadParams[0];
$defkey = $NewadParams[1];
$align = $NewadParams[2];
}
if ($mykeyword==""){$mykeyword= $params->get('ad_keywords');}
if ($defkey==""){$defkey = $params->get('ad_default_keywords');}
if ($align==""){$align = "center";}
$adHTML_1 = $GLOBALS['botNewadHTML1'];
$adHTML_3 = $GLOBALS['botNewadHTML3'];
$adHTML .= $adHTML_1;
$adHTML .= "ad_keywords = Array("" . $mykeyword . ""); rn";
$adHTML .= "ad_default_keywords = Array("" . $defkey . ""); rn";
$adHTML .= $adHTML_3;
$margin=0;
return botMosjrheader_align($align, $margin, $adHTML);
}
function botMosjrheader_align($align, $margin, $relevantAd)
{
if ($align == "none")
return "<div>".$relevantAd."</div>" ;
if ($align != "center"){
return "<div style='float:".$align."; margin-top:".$margin."px ; margin-left:".$margin."px ; margin-right:".$margin."px ; margin-bottom:".$margin."px ;'>".$relevantAd."</div>" ;}
return "<div align='center' style='margin-top:".$margin."px ; margin-bottom:".$margin."px ;'>".$relevantAd."</div>" ;
}
?>

No comments posted yet

Your Answer:

Login to answer
117 Like 14 Dislike
Previous forums Next forums
Other forums

Online Event Ticket Sales
Has anyone wrote a script for online tickets sales?

I have been googling and found lots of th

script and html conflict in trying to create a header.
I have an error is occurring because of an html webpage with a "php require" at the top of

can i optmize image to 50% quality before uploading 2 server
Hi there

i have jus written a php program to upload and display images but when i try to uplo

MII Netweaver Server stopped due to CPIC connection Problem
Dear Experts,
We have SAP XMII 12.0 setup running on Netweaver 2004s,7.0, Java Stack only.

Ajax Error since Upgrading to 3.5
Ever since upgrading my site to .NET 3.5 (I needed LINQ), I've been getting this annoying error on o

Google voice
I currently have a form in html, but I want it in php so the information is not in the source code.<

Whats wrong with my query?
I am trying to get this query to show the appropriate ticked vehicle roof height, unless no boxs are

Working with popups and such in a class
I've recently started building my applications completely enclosed in classes. I like the fact that

SQL Query/echo not working
Hey all,

I'm trying to run (what I thought) was a simple operation and it isn't working. I h

Unable to retreve the values from Mysql Query
Hi,

Here is the php code that I have, Query is running properly in phpmyadmin and is resu

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash