fuzje Posted April 27, 2010 Share Posted April 27, 2010 Hi all I am setting up a corporate intranet site using joomla and docman to hold files. I have been given a category structure that will have over 8000 categories. I have loaded this into the docman table in the joomla database, and due to the large number of categories, the front end in the web interface has suddenly become very slow and unusable. I have looked into the code and believe the problem is caused by holding all the category IDs in an array. function fetchCategory($id) { global $_DMUSER; $cat = new DOCMAN_Category($id); // if the user is not authorized to access this category, redirect if(!$_DMUSER->canAccessCategory($cat->getDBObject())) { _returnTo('' , _DML_NOT_AUTHORIZED); } // process content mambots DOCMAN_Utils::processContentBots( $cat, 'description' ); return HTML_DMCategories::displayCategory($cat->getLinkObject(), $cat->getPathObject(), $cat->getDataObject()); } function fetchCategoryList($id) { global $_DOCMAN, $_DMUSER; $children = DOCMAN_Cats::getChildsByUserAccess($id); $items = array(); foreach($children as $child) { $cat = new DOCMAN_Category($child->id); // process content mambots DOCMAN_Utils::processContentBots( $cat, 'description' ); $item = new StdClass(); $item->links = &$cat->getLinkObject(); $item->paths = &$cat->getPathObject(); $item->data = &$cat->getDataObject(); $items[] = $item; } // display the entries return HTML_DMCategories::displayCategoryList($items); } I believe the issue lies under the function_fetchCategoryList ($id). Each page loads from the ID of the parent category in the front end. (for example http://myserver/index.php?option=com_docman&task=cat_view&gid=4 loads all the categories that have a parent ID of 4) What I want is something that loads only the categories needed for that page and not loop looking for child IDs for the next 8000 categories, only the ones directly below. Apologies if I don't make much sense. My php knowledge is very limited and I don't even know if what I am proposing is possible. The developer is looking into this but this is something I need to get working urgently as the developer has other issues to sort. I have been told that the company do not mind paying someone to try and solve the issue. I can provide front and backend access if needed. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/199904-joomla-docman-category-loop-array/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.