MambelFish 1.5 and Joomla 1.0.4

Installation

I just want to explain what worked for me, I have Joomla 1.0.4 and PHP 4.4.0... Still I have some warnings, but it works now...

thanks for helping me on this "alexhokamp", everything on this Mini-howto was gave it to me from "alexhokamp"...

1.- Download and Install the new fresh Joomla 1.0.4 on your favorite site, even JSAS for testing

2. Download MambelFish pack from attachment (mambelfish_pack.zip)

3. Install mambelfish component, module and mambot. Publish module and mambot

4. Download patch files from attachment too (Joom104_MF.zip)

5. Replace files from patch zip file:

/administrator/components/com_mambelfish/mambelfish.class.php /includes/domit/xml_domit_lite_parser.php

6. Configure Mambel fish and languages files to your needs

Jom104_MF.zip (51.4 KB - downloaded 154 times.)

mambelfish_pack.zip (194.09 KB - downloaded 147 times.)

Installation, method 2:

http://forum.joomla.org/index.php/topic,26271.0.html

Search warnings

Warning: array_keys(): The first argument should be an array in /vol/www2/vcwi/htdocs/new/components/com_mambelfish/classes/mambelfish.class.php on line 164

Warning: Invalid argument supplied for foreach() in /vol/www2/vcwi/htdocs/new/components/com_mambelfish/classes/mambelfish.class.php on line 164

As said before I did not really solve it but prevented it from throwing a warning. I just added this line before line 164

if (!isset($rows)) return;

The solution is deeper because that function 'translateList' is called with no $rows specified. I did not investigate the cause that. Since mbf did work OK. There are several liitle flaws within mambelfish as you may have found in the forum. PHP version problems Even the lttle mbf search bot has a flaw. The search results are returned twice. Just by adding DISTINCT right after the SELECT statement will correct it.

The following thread goes deeper into the problems and solutions http://forum.joomla.org/index.php/topic,8785.0.html

I did not go that far and only solved the things that bothered me. For that reason I made the mbf system bot and I use already a different version to be prepared for Joomla.1.1 But for some reason I would be more happy if it was released by Alex to tighten the gap between MBF and Joomla. In general mambelfish works OK

I assumed that this is for the Mambo 4.5.2 and MambleFish 1.5 Released version. Next time include your version please. I works also for Joomla 1.0.4

You have to modify two files to make this work. com_weblinks/weblinks.php and com_weblinks/weblinks.html.php.

1. change entire function listWeblinks in com_weblinks/weblinks.php with these codes:

function listWeblinks( $catid ) {
global $mainframe, $database, $my;
global $mosConfig_shownoauth, $mosConfig_live_site, $mosConfig_absolute_path;
global $cur_template, $Itemid;
// MAMBLEFISH FIX BY AB ZAHRI AB AZIZIS - TRANSLATION GLOBAL VARIABLES
global $mosConfig_lang, $mosConfig_mbf_content;
// END MAMBLEFISH FIX BY AB ZAHRI AB AZIZIS - TRANSLATION GLOBAL VARIABLES

/* Query to retrieve all categories that belong under the web links section and that are published. */
// MAMBLEFISH FIX BY AB ZAHRI AB AZIZIS - MODIFY THE QUERY
//$query = "SELECT *, COUNT(a.id) AS numlinks FROM #__categories AS cc"
$query = "SELECT cc.*, COUNT(a.id) AS numlinks FROM #__categories AS cc"
// END MAMBLEFISH FIX BY AB ZAHRI AB AZIZIS - MODIFY THE QUERY
. "\n LEFT JOIN #__weblinks AS a ON a.catid = cc.id"
. "\n WHERE a.published='1' AND a.approved='1' AND section='com_weblinks' AND cc.published='1' AND cc.access <= '$my->gid'"
. "\n GROUP BY cc.id"
. "\n ORDER BY cc.ordering"
;
$database->setQuery( $query );
$categories = $database->loadObjectList();
// MAMBLEFISH FIX BY AB ZAHRI AB AZIZIS - TRANSLATING THE CATEGORIES
if( $mosConfig_mbf_content ) { $categories = MambelFish::translateList( $categories, 'categories', $mosConfig_lang); }
// END MAMBLEFISH FIX BY AB ZAHRI AB AZIZIS - TRANSLATING THE CATEGORIES

$rows = array();
$currentcat = NULL;
if ( $catid ) {
// url links info for category
$query = "SELECT id, url, title, description, date, hits, params FROM #__weblinks"
. "\nWHERE catid = '$catid' AND published='1' AND approved='1' AND archived=0"
. "\nORDER BY ordering"
;
$database->setQuery( $query );
$rows = $database->loadObjectList();

// current cate info
// MAMBLEFISH FIX BY AB ZAHRI AB AZIZIS - MODIFY THE QUERY
//$query = "SELECT name, description, image, image_position FROM #__categories"
$query = "SELECT * FROM #__categories"
// END MAMBLEFISH FIX BY AB ZAHRI AB AZIZIS - MODIFY THE QUERY
. "\n WHERE id = '$catid'"
. "\n AND published = '1'"
;
$database->setQuery( $query );
$database->loadObject( $currentcat );
// MAMBLEFISH FIX BY AB ZAHRI AB AZIZIS - TRANSLATING THE CURRENT CATEGORIES
if( $mosConfig_mbf_content ) { $currentcat = MambelFish::translate( $currentcat, 'categories', $mosConfig_lang); }
// END MAMBLEFISH FIX BY AB ZAHRI AB AZIZIS - TRANSLATING THE CURRENT CATEGORIES
}

// Parameters
$menu =& new mosMenu( $database );
$menu->load( $Itemid );
$params =& new mosParameters( $menu->params );
$params->def( 'page_title', 1 );
$params->def( 'header', $menu->name );
$params->def( 'pageclass_sfx', '' );
$params->def( 'headings', 1 );
$params->def( 'hits', $mainframe->getCfg( 'hits' ) );
$params->def( 'item_description', 1 );
$params->def( 'other_cat_section', 1 );
$params->def( 'other_cat', 1 );
$params->def( 'description', 1 );
$params->def( 'description_text', _WEBLINKS_DESC );
$params->def( 'image', '-1' );
$params->def( 'weblink_icons', '' );
$params->def( 'image_align', 'right' );
$params->def( 'back_button', $mainframe->getCfg( 'back_button' ) );

if ( $catid ) {
$params->set( 'type', 'category' );
} else {
$params->set( 'type', 'section' );
}

// page description
$currentcat->descrip = '';
if( ( @$currentcat->description ) <> '' ) {
$currentcat->descrip = $currentcat->description;
} else if ( !$catid ) {
// show description
if ( $params->get( 'description' ) ) {
$currentcat->descrip = $params->get( 'description_text' );
}
}

// page image
$currentcat->img = '';
$path = $mosConfig_live_site .'/images/stories/';
if ( ( @$currentcat->image ) <> '' ) {
$currentcat->img = $path . $currentcat->image;
$currentcat->align = $currentcat->image_position;
} else if ( !$catid ) {
if ( $params->get( 'image' ) <> -1 ) {
$currentcat->img = $path . $params->get( 'image' );
$currentcat->align = $params->get( 'image_align' );
}
}

// page header
$currentcat->header = '';
if ( @$currentcat->name <> '' ) {
$currentcat->header = $currentcat->name;
} else {
$currentcat->header = $params->get( 'header' );
}

// used to show table rows in alternating colours
$tabclass = array( 'sectiontableentry1', 'sectiontableentry2' );

HTML_weblinks::displaylist( $categories, $rows, $catid, $currentcat, $params, $tabclass );
}

2. Change entire function showCategories in com_weblinks/weblinks.html.php with these codes:

function showCategories( &$params, &$categories, $catid ) {
global $mosConfig_live_site, $Itemid;
?>
<ul>
<?php
foreach ( $categories as $cat ) {
// MAMBLEFISH FIX BY AB ZAHRI AB AZIZIS - MODIFY IF STATEMENTS [ catid column has been removed from query ]
//if ( $catid == $cat->catid ) {
if ( $catid == $cat->id ) {
// END MAMBLEFISH FIX BY AB ZAHRI AB AZIZIS - MODIFY IF STATEMENT
?>
<li>
<b>
<?php echo $cat->name;?>
</b>
&nbsp;
<span class="small">
(<?php echo $cat->numlinks;?>)
</span>
</li>
<?php
} else {
// MAMBLEFISH FIX BY AB ZAHRI AB AZIZIS - MODIFY LINK [ catid column has been removed from query ]
//$link = 'index.php?option=com_weblinks&catid='. $cat->catid .'&Itemid='. $Itemid;
$link = 'index.php?option=com_weblinks&catid='. $cat->id .'&Itemid='. $Itemid;
// MAMBLEFISH FIX BY AB ZAHRI AB AZIZIS - END MODIFY LINK
?>
<li>
<a href="<?php echo sefRelToAbs( $link ); ?>" class="category<?php echo $params->get( 'pageclass_sfx' ); ?>">
<?php echo $cat->name;?>
</a>
&nbsp;
<span class="small">
(<?php echo $cat->numlinks;?>)
</span>
</li>
<?php
}
}
?>
</ul>
<?php
}

3. Save both files (upload) and you are done.

Alex I have commented this modification please review and include it as your patch files.

Maybe necessary: includes/joomla.php to make changes to default language as original content

line 79:

$database = new database( $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix );

change to:

if (file_exists( 'components/com_mambelfish/mambelfish.php' )) {
        $mosConfig_mbf_content='1';             // can also go into the configuration - but this might be overwritten!
        require_once( "administrator/components/com_mambelfish/mambelfish.class.php");
        require_once( "components/com_mambelfish/classes/mambelfish.class.php");
}
if( $mosConfig_mbf_content ) {
        $database = new mlDatabase( $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix );
} else {
        $database = new database( $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix );
}
if ($mosConfig_mbf_content) {
        $mosConfig_defaultLang = $mosConfig_lang;               // Save the default language of the site
        $iso_client_lang = MambelFish::discoverLanguage( $database );
        $_MAMBELFISH_MANAGER = new MambelFishManager();

}

JunHu: JunHu/Memo/JoomlaTipsAndTricks/MambelFish (last edited 2008-10-03 20:20:08 by localhost)