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
14
Other forums
Tracking Unique Clicks
Hi guys and gals,
Basically I have a database which tracks clicks on my outbound links, I do
Empty text file when there is over XXXX lines of text.
define("RANDOM_FILE","/public_html/random.txt");
$randomEntry = "
PHP5/Zend 2.0 - Resources
PHP5 Snapshots
http://snaps.php.net/
ZEND 2.0 Feature Overview and Design (PDF File
MII Trends - add data onto chart object
Hello,
Can anyone please provide some thoughts on my current requirement:
its pretty
Passing variables with pagination - iterating through unique id per link
Hi everyone,
I have seen a few topics like this one. Still cant find the specific thing, so I am
RSS poster script?
I have found a script that posts RSS's for me on a site that I'm building. However I would like to a
Array disappearing in foreach loop
Okay, I have this problem where an array will become undefined in a foreach loop.
Here is the
Dynamically allocating the number of rows in a table based on a variable value
Hi,
I have situation here which i cannot resolve, I have a variable temp which stores the num
Suggestions for Functional module
Hello experts,
I Have done B.Sc(Mathematics) and MCA & have learnt SAP/ABAP but do n
Loop Through Date Range
Hi guys,
I have date range as parameter like 01/JAN/2009 TO 16/JAN/2009 now i want to loop thro