View Full Version : Sub categories in left Pannel
capelton
05-17-2005, 05:38 AM
Ok this is me the troublesome BUG..
I was wondering, I have been getting quite troubled by sub categories appearing like a links directory or an FAQ directory. Why cant , or can it be done that the sub categories just appear on the left hand side in vertical format please.
It would be so much cleaner, and having all displayed content coherent throughout. I have gorwn so accustomed to seeing oly content in the middle column, that have sub-Cs in there just throws it all out of Wack for me.
Chris S
05-18-2005, 03:16 AM
Hi,
It's not a bug, it's a design implementation / feature / issue (depending on how you look at it).
If you really want to move them then it'll be quite a hack, but I can provide some info on how to do it (hope your php skills are ok).
Ok this is me the troublesome BUG..
I was wondering, I have been getting quite troubled by sub categories appearing like a links directory or an FAQ directory. Why cant , or can it be done that the sub categories just appear on the left hand side in vertical format please.
It would be so much cleaner, and having all displayed content coherent throughout. I have gorwn so accustomed to seeing oly content in the middle column, that have sub-Cs in there just throws it all out of Wack for me.
capelton
05-20-2005, 01:06 AM
hahahaha, thanks
but PHP on my side is poor, i can manipulate only the code, meaning i can take any PHP code and skin it for any deisgn - and everyone thinks i know PHP, i dont know it, just how to make it look pretty.
So if it requires juggling thigns around, then sure i can do that, other wise if its working with "if" "else" statements and functions then i am out........... But hey thanks a million
Chris S
05-20-2005, 03:36 AM
Hi,
We usually give pretty clear instructions on what you need to do, so you won't be left with "it's in this file" type of answers ;)
hahahaha, thanks
but PHP on my side is poor, i can manipulate only the code, meaning i can take any PHP code and skin it for any deisgn - and everyone thinks i know PHP, i dont know it, just how to make it look pretty.
So if it requires juggling thigns around, then sure i can do that, other wise if its working with "if" "else" statements and functions then i am out........... But hey thanks a million
Janet
07-30-2005, 12:30 PM
Chris.
I'd like to know how to do this. My PHP ain't brilliant but I can follow instructions.
how can I get the info from you?
Chris S
08-02-2005, 04:59 AM
Hi Janet,
This change prints all categories and subcategories in the left nav.
Backup before you start.
This example is for the 'Slick Stretched' template so you may have to adjust it to get it working for your template.
The file is 'RootArticleCategoriesPanel.php'
Note this doesn't show/hide depending on whether a subcategory has any articles in it, it just displays all subcategories (and it doesn't change whether you're in a particular category or not, they are all links).
Modify the '_GetCategoryList' function to look like:
function _GetCategoryList()
{
// Get a list of article categories and return them
$output = "";
$query = sprintf("select * from %scategories where ParentID=0 order by Name asc", $GLOBALS["AL_CFG"]["tablePrefix"]);
$catResult = mysql_query($query);
while($catRow = mysql_fetch_array($catResult))
{
$subcatlist = $this->_GetSubCats($catRow["CategoryID"]);
$output .= sprintf("
<div class=\"BulletItem\">
<A href='%s'>%s</A><br/>%s
</div>
", AL_HELPER::CategoryLink($catRow["CategoryID"], $catRow["Name"]), $catRow["Name"], $subcatlist);
}
if(mysql_num_rows($catResult) == 0)
$output .= sprintf("<div>%s</div>", $GLOBALS["AL_LANG"]["hpNoCategories"]);
return $output;
}
and add this underneath:
function _GetSubCats($parentid=0) {
$output = "";
$query = sprintf("select * from %scategories where ParentID='%d' order by Name asc", $GLOBALS["AL_CFG"]["tablePrefix"], (int)$parentid);
$subcatResult = mysql_query($query);
if (mysql_num_rows($subcatResult) == 0) return $output;
while($subcatRow = mysql_fetch_array($subcatResult)) {
$subcatlist = $this->_GetSubCats($subcatRow["CategoryID"]);
$subcatlink = AL_HELPER::CategoryLink($subcatRow["CategoryID"], $subcatRow["Name"]);
$output .= sprintf("
<div class=\"BulletItem\">
<A href='%s'>%s</A><br/>%s
</div>
", $subcatlink, $subcatRow["Name"], $subcatlist);
}
return $output;
}
The differences between the templates are how the divs are generated, so they may differ in whichever template you are using. But that should be it.
Chris.
I'd like to know how to do this. My PHP ain't brilliant but I can follow instructions.
how can I get the info from you?
Luvluv
12-22-2005, 06:57 PM
with that hack, sub cat in left panel. it make your server quite busy if you have many categories and sub cat because that function called every time we generate page. am i right???
Chris S
12-23-2005, 01:02 AM
Hi,
Yes it will.
If you notice any major performance issues let us know and we'll take a look at it - you will notice a performance change because it has a lot more work to do, but if it's a lot then tell us.
with that hack, sub cat in left panel. it make your server quite busy if you have many categories and sub cat because that function called every time we generate page. am i right???
webdog
06-02-2006, 06:26 PM
Has anyone had any luck working this for the Default template? I can get the subcategories to show, but the DIVs are messed up. The subcat DIVs basically nest inside of the main cat DIVs, instead of separating them. Something like this...
<div class="mainbuttons2">
<A href='http://www.forestohio.net/categories/Business/'>Business</A><br/>
<div class="buttons">
<A href='http://www.forestohio.net/categories/Business/Tax-Forms/'>Tax Forms</A><br/>
</div>
</div>
What is should be doing is something like...
<div class="mainbuttons2">
<A href='http://www.forestohio.net/categories/Business/'>Business</A><br/>
</div>
<div class="buttons">
<A href='http://www.forestohio.net/categories/Business/Tax-Forms/'>Tax Forms</A><br/>
</div>
I would really appreciate some help on this. I can provide the RootArticleCategories.php that I have if it would be helpful.
Thanks!
hadion
09-05-2006, 03:24 PM
Hi all,
I want the script only shows the subcategories in the left panel WHICH are subcategory of the current u are browsing at that moment. (same level)
Can anybody help me?
Example
-----------------------------------------------------------------------------
Interspire Homepage
Home - Cars - Fast cars (trail)
Categories:
- Cars TEXT
- Houses
- Boats
Subcategories:
- Fast cars
- Beautiful cars
-----------------------------------------------------------------------------
This is my current code:
<?php
/*******************************************\
* *
* Generic ArticleLive Panel Parsing Class *
* *
\*******************************************/
$panelClass = "AL_ROOTARTICLECATEGORIES_PANEL";
if(!class_exists($panelClass)){
CLASS AL_ROOTARTICLECATEGORIES_PANEL
{
var $_htmlFile;
function AL_ROOTARTICLECATEGORIES_PANEL($HTMLFile)
{
$this->_htmlFile = $HTMLFile;
}
function ParsePanel()
{
$htmlPanelData = "";
$parsedPanelData = "";
if(file_exists($this->_htmlFile))
{
if($fp = @fopen($this->_htmlFile, "rb"))
{
while(!feof($fp))
$htmlPanelData .= fgets($fp, 4096);
@fclose($fp);
}
}
// Parse the panel of tokens, etc
$GLOBALS["CategoryList"] = $this->_GetCategoryList();
$GLOBALS["SubCategoriesTable"] = $this->_GetSubCats(); /* i want the script fills in the current category ID */
$parsedPanelData = $GLOBALS["AL_CLASS_TEMPLATE"]->ParseGL($htmlPanelData);
return $parsedPanelData;
}
function _GetCategoryList()
{
// Get a list of article categories and return them
$output = "";
$query = sprintf("select * from %scategories where ParentID=0 order by SortOrder asc, Name asc", $GLOBALS["AL_CFG"]["tablePrefix"]);
$catResult = mysql_query($query);
while($catRow = mysql_fetch_array($catResult))
{
$output .= sprintf("
<div class=\"ListItem\">
<a href='%s'>
%s
</a>
</div>
", AL_HELPER::CategoryLink($catRow["CategoryID"], $catRow["Name"]), $catRow["Name"]);
}
if(mysql_num_rows($catResult) == 0)
$output .= sprintf("<div>%s</div>", $GLOBALS["AL_LANG"]["hpNoCategories"]);
return $output;
}
/* i want the script fills in the current category ID */
function _GetSubCats($parentid=3) {
$output = "";
$query = sprintf("select * from %scategories where ParentID='%d' order by Name asc", $GLOBALS["AL_CFG"]["tablePrefix"], (int)$parentid);
$subcatResult = mysql_query($query);
if (mysql_num_rows($subcatResult) == 0) return $output;
while($subcatRow = mysql_fetch_array($subcatResult)) {
$subcatlist = $this->_GetSubCats($subcatRow["CategoryID"]);
$subcatlink = AL_HELPER::CategoryLink($subcatRow["CategoryID"], $subcatRow["Name"]);
$output .= sprintf("
<div>
<A href='%s'>%s</A><br/>%s
</div>
", $subcatlink, $subcatRow["Name"], $subcatlist);
}
return $output;
}
}
}
?>
timmyjane
12-07-2008, 03:08 AM
anyone know how to make this last post work?
Argos
12-07-2008, 11:54 AM
anyone know how to make this last post work?
You have replied to a post that's about two and a half years old... The script has changed since then. In the admin you will find an option to show the subcats only when clicked on the parent cat.
timmyjane
12-07-2008, 02:07 PM
Whoops. I wasnt paying attention. I also missed that the forum was for AL and not shopping cart. Sometimes I get wrapped up and forget that interspire makes other products since i only use SC.