How do you override functions that are located in BxBaseMenu.php?

I was told by AlexT, that to override a function in BxBaseMenu.php, that all you have to do, is copy it to BxTmplMenu.php in your templates /scripts directory, and make the changes.

Here's his exact words:

If you need to modify menu html you need to override appropriate method in BxTemplMenu.php file. For example to add custom class to topMenu table you can copy genTopHeader method from BxBaseMenu.php and insert it to BxTemplMenu.php file:

/*
* Generate top header part
*/
function genTopHeader() {
$iCurrent = $this->checkShowCurSub() ? 0 : $this->aMenuInfo['currentTop'];
$this->sCode .= '<table class="topMenu MY_SUPER_CLASS_HERE" cellpadding="0" cellspacing="0" style="width:' . $this->sWidth . '"><tr>';
}

 

So why doesn't this work, when copied to my BxTmplMenu.php? (Top menu search item removed)

/*
* Generate search element
*/
function genSearchElement() {
$sSearchC = process_line_output(_t('_Search'));
ob_start();
?>
<script language="javascript">
$(document).ready( function() {
$('#keyword').blur(function() {
$('#keyword').removeClass();
$('#keyword').addClass('input_main');
if ('' == $('#keyword').val())
$('#keyword').val('<?= $sSearchC ?>');
}
);
$('#keyword').focus(function() {
$('#keyword').removeClass();
$('#keyword').addClass('input_focus');
if ('<?= $sSearchC ?>' == $('#keyword').val())
$('#keyword').val('');
}
);
});
</script>

<?

}

It's the same concept.... isn't it?

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 3 Mar 2011

Do you want that search item will removed from menu?

PS: If possible do not write me personally, please try to ask on the forum first
Quote · 3 Mar 2011
Yes, but only for one particular template.... Not all templates, so I can't remove it from BxBaseMenu.php.
My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 3 Mar 2011

 

Yes, but only for one particular template.... Not all templates, so I can't remove it from BxBaseMenu.php.

Ok open the templates\tmpl_uni\scripts\BxTemplMenu.php for example and add this override method:

function genSearchElement()
{

return;
}

into class BxTemplMenu

for example :

 

/**
* @see BxBaseMenu;
*/
class BxTemplMenu extends BxBaseMenu {

/**
* Class constructor;
*/
function BxTemplMenu() {
parent::BxBaseMenu();
}

function genSearchElement()
{

return;
}

}

PS: If possible do not write me personally, please try to ask on the forum first
Quote · 3 Mar 2011

Thanks... that works.  I had my code slightly mis-positioned.

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 3 Mar 2011

 

Thanks... that works.  I had my code slightly mis-positioned.

You're welcome

PS: If possible do not write me personally, please try to ask on the forum first
Quote · 4 Mar 2011
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.