Hi all!
I instaled smartpartner 2.0 but I got only blank pages, so I decided to install SmartPartner version 1.4 (RC 1).
WHAT I WANT:
I tested several moduls in order to have an yellow pages site and a list of number fones of my city (about 17,000) and smartpartner was what best fit my propose (If someone has a better idea is welcome)
WHAT I USE:
XOOPS 2.0.18.1
SmartPartner version 1.4 (RC 1).
Easy PHP 2.0.0.0
phpMyAdmin 2.9.1.1
MySQL: 5.0.22
PHP Version 5.2.0
THE PROBLEM
I inserted the 17,000 phone numbers on DB.
When I do a search using XOOPS native sercher, Is everything OK, But when I enter the smartpartner category listing (eG:
http://localhost/ltlnossalista/modules/smartpartner/index.php?view_category_id=3), there are a big delay and a 100% CPU usage, which ends on blank page sometimes.
The funniest is that even if i go to another page, the usage of CPU continues.
look:
THE CODES:
MYSQL TABLES:
CREATE TABLE `ccr091202_smartpartner_partner` (
`id` int(11) NOT NULL auto_increment,
`categoryid` int(11) NOT NULL default '11',
`weight` int(10) NOT NULL default '0',
`datesub` int(11) NOT NULL default '1259850053',
`hits` int(10) NOT NULL default '0',
`hits_page` int(10) NOT NULL default '0',
`url` varchar(150) default '',
`image` varchar(150) NOT NULL default '-1',
`image_url` varchar(255) NOT NULL default '',
`title` varchar(255) NOT NULL default '',
`summary` text NOT NULL default 'Pirassununga/SP',
`description` text NOT NULL default ' ',
`contact_name` varchar(255) NOT NULL default '',
`contact_email` varchar(255) NOT NULL default '',
`contact_phone` varchar(255) NOT NULL default '',
`adress` text NOT NULL,
`status` tinyint(1) NOT NULL default '2',
`email_priv` tinyint(1) NOT NULL default '0',
`phone_priv` tinyint(1) NOT NULL default '0',
`adress_priv` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `status` (`status`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='SmartPartner by marcan' AUTO_INCREMENT=10 ;
INSERT INTO `ccr091202_smartpartner_partner` (`id`, `categoryid`, `weight`, `datesub`, `hits`, `hits_page`, `url`, `image`, `image_url`, `title`, `summary`, `description`, `contact_name`, `contact_email`, `contact_phone`, `adress`, `status`, `email_priv`, `phone_priv`, `adress_priv`) VALUES
(10001, 11, 0, 1259850053, 0, 0, '', '-1', '', 'Pedro de Carvalho', 'Pirassununga/SP', ' ', '', '', '3561 9057', 'Rua João felício Filho, 710 - Jardim Redentor', 2, 0, 0, 0),
(10002, 11, 0, 1259850053, 0, 0, '', '-1', '', 'Márcia Montovani', 'Pirassununga/SP', ' ', '', '', '3561 1234', 'Rua Mascarenhas pedroso, 710 - Jardim Redentor', 2, 0, 0, 0),
(10003, 11, 0, 1259850053, 0, 0, '', '-1', '', 'Carmo castro', 'Pirassununga/SP', '', '', ' ', '3561 4321', 'Rua José Felício, 2710 - Jardim Rntor', 2, 0, 0, 0);
AND SO ON
THE PHP (smartpartner/index.php?view_category_id):
/**
* $Id: index.php,v 1.27 2006/02/13 17:42:12 malanciault Exp $
* Module: SmartPartner
* Author: The SmartFactory
* Licence: GNU
*/
/**
*Ceci nous produira un tableau de forme:
*
*PartnersArray[] =
* PartnersArray[TopCat1][info] = (nom, description)
* PartnersArray[TopCat1][partners] = array de partner (via fct get_partners_array())
* PartnersArray[TopCat1][subcats][0][info] = (nom, description)
* PartnersArray[TopCat1][subcats][0][partners] = array de partner
* PartnersArray[TopCat1][subcats][0][subcats]....
* Ainsi de suite
*
*ex: PartnersArray[TopCat1][partners][0][nom] contiendra le nom du 1er partenaire de TopCat1
*
*/
/**
*Loop inside the array of all partners to match with current category
*
*param $categoryid - id of the current category
*return array of partners for the current category
*/
function get_partners_array($categoryid){
foreach ($every_partners_array as $partnerObj ){
if($partnerObj->categoryid() == $categoryid && ($view_category_id || (!$view_category_id && sizeof($partners) < $xoopsModuleConfig['percat_user']))){
$partner = $partnerObj->toArray('index');
$partners[] = $partner;
}
}
return $partners;
}
/**
*Loop inside the array of all categories to find subcats for current category
*recusrive function: for each subcat found, call to function getcontent to
*get partners and subcats within it
*
*param $categoryid - id of the current category
*return array of subcats for the current category
*/
function get_subcats($every_categories_array,$categoryid, $level){
//global $every_categories_array;
$subcatArray = array();
$level++;
foreach ($every_categories_array as $subcatObj) {
if($subcatObj->parentid() == $categoryid ){
$subcatArray[] = get_cat_content($every_categories_array,$subcatObj,$level);
}
}
return $subcatArray;
}
/**
*Retrieve content for the current category
*
*param $categoryid - id of the current category
*return array of content for the current category
*/
function get_cat_content($every_categories_array, $categoryObj,$level){
$category = array();
$decalage='';
for($i=0;$i<$level;$i++){
$decalage .= '--';
}
$decalage .= ' ';
$category['title'] = $decalage.''.$categoryObj->name();
$category['description'] = $categoryObj->description();
$category['link_view'] = $categoryObj->getCategoryUrl();
$category['partners'] = get_partners_array($categoryObj->categoryid());
$category['image_url'] = $categoryObj->getImageUrl(true);
$category['subcats'] = get_subcats($every_categories_array,$categoryObj->categoryid(),$level);
return $category;
}
include "header.php";
$xoopsOption['template_main'] = 'smartpartner_index.html';
include XOOPS_ROOT_PATH."/header.php";
include "footer.php";
// At which record shall we start
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
$view_category_id = isset($_GET['view_category_id']) ? intval($_GET['view_category_id']) : 0;
$partners_total = $smartpartner_partner_handler->getPartnerCount();
if($xoopsModuleConfig['index_sortby']== 'title' || $xoopsModuleConfig['index_sortby']== 'weight'){
$order = 'ASC';
}
else{
$order = 'DESC';
}
//Retreive all records from database
$every_categories_array = $smartpartner_category_handler->getCategories(0,0,-1,'weight', 'ASC', true);
$every_partners_array = $smartpartner_partner_handler->getPartnersForIndex(-1, _SPARTNER_STATUS_ACTIVE, $xoopsModuleConfig['index_sortby'], $order);
$partnersArray = array();
//display All categories and partners
if(!$view_category_id){
//get orphan first if preference says so
if($xoopsModuleConfig['orphan_first']){
$partnersArray['orphan']['partners']= get_partners_array(0);
}
//get all categories and content
foreach ( $every_categories_array as $categoryObj){
if ($categoryObj->parentid()==0){
$partnersArray[] = get_cat_content($every_categories_array, $categoryObj,0);
}
}
//get orphan last if preference says so
if(!$xoopsModuleConfig['orphan_first']){
$partnersArray['orphan']['partners']= get_partners_array(0);
}
$categoryPath = '';
}
//viewing a specific category
else{
$currentCategoryObj = $every_categories_array[$view_category_id];
$partnersArray[] = get_cat_content($every_categories_array, $currentCategoryObj, 0);
if (!$partnersArray[0]['partners'] && !$partnersArray[0]['subcats']) {
redirect_header(SMARTPARTNER_URL, 3, _MD_SPARTNER_CATEGORY_EMPTY);
}
// Retreiving the category path
$categoryPath = $currentCategoryObj->getCategoryPath();
}
//$partners_total_onpage = $count;.partners
$xoopsTpl->assign('partners', $partnersArray);
//end new code to implement categories
// Partners Navigation Bar
//$pagenav = new XoopsPageNav($partners_total_onpage, $xoopsModuleConfig['perpage_user'], $start, 'start', '');
//$xoopsTpl->assign('pagenav', '' . $pagenav->renderNav() . '
');
$xoopsTpl->assign('view_deteils_cat', _MD_SPARTNER_DETAIL_CAT);
$xoopsTpl->assign('on_index_page', $view_category_id == 0);
$xoopsTpl->assign('sitename', $xoopsConfig['sitename']);
$xoopsTpl->assign("displayjoin" , $xoopsModuleConfig['allowsubmit'] && (is_object($xoopsUser) || $xoopsModuleConfig['anonpost']));
$xoopsTpl->assign("img_max_width" , $xoopsModuleConfig['img_max_width']);
$xoopsTpl->assign('module_home', '. SMARTPARTNER_URL . '">' . $smartpartner_moduleName . '');
$xoopsTpl->assign('categoryPath', $categoryPath);
$xoopsTpl->assign('lang_intro_text' , $myts->displayTarea($xoopsModuleConfig['welcomemsg']));
$xoopsTpl->assign('lang_partner', _MD_SPARTNER_PARTNER);
$xoopsTpl->assign('lang_desc', _MD_SPARTNER_DESCRIPTION);
$xoopsTpl->assign('lang_edit', _MD_SPARTNER_EDIT);
$xoopsTpl->assign('lang_delete', _MD_SPARTNER_DELETE);
$xoopsTpl->assign('lang_hits', _MD_SPARTNER_HITS);
$xoopsTpl->assign('lang_join' , _MD_SPARTNER_JOIN);
$xoopsTpl->assign('lang_no_partners', _MD_SPARTNER_NOPART);
$xoopsTpl->assign('lang_main_partner', _MD_SPARTNER_PARTNERS);
$xoopsTpl->assign('lang_readmore', _MD_SPARTNER_READMORE);
if(!$xoopsModuleConfig['hide_module_name']){
$xoopsTpl->assign('lang_partnerstitle', $myts->displayTarea($xoopsModule->getVar('name')));
}
include_once XOOPS_ROOT_PATH.'/footer.php';
?>
It must have a loop or such thing but I couldn´t find it.
I tried to give you all information. If someone can help me I would apreciate a lot.
Thank you in advanced!!!!