PDA

View Full Version : Show sub category on left menu.


Millionaire
10-26-2004, 01:30 PM
Can we show the sub categories under it's category for the left menu?

Like this...

Category 1
- Sub Category
- Sub Category
- Sub Category

Category 2
- Sub Category
- Sub Category
- Sub Category

Category 3
- Sub Category
- Sub Category
- Sub Category

Mitch (Interspire Staff)
10-27-2004, 04:02 AM
Hi Millionaire,
Not without customizing the panel, which is what I'm assuming you want to do? If so, you need to edit the templates/{Your Template}/Panels/RootArticleCategoriesPanel.php and make changes in the file. If you can't figure it out let me know and I'll try and point you in the right direction :)

Millionaire
11-07-2004, 10:13 AM
I look into the file. Have no idea what to edit.

What's the code to add to make it show

Category 1
- Sub Category
- Sub Category
- Sub Category

Category 2
- Sub Category
- Sub Category
- Sub Category

and so on....

Mitch (Interspire Staff)
11-08-2004, 12:37 AM
Hi Millionaire,
It's quite a huge customization to perform. Are you familiar with PHP? You need to edit a fairly complex inner-join query and add a couple of loops into a function.

Millionaire
11-08-2004, 04:35 AM
I'm not a programmer.

Can you please tell me what are the codes to edit?

Mitch (Interspire Staff)
11-09-2004, 12:34 AM
Hi Millionaire,
We don't perform customizations under any circumstance, but if you aren't a programmer then it's not really going to be possible to explain what to do as it's quite a few changes that need to take place. Maybe you can submit a support ticket with your FTP details and ArticleLive URL and admin login and I can implement this once-off customization for you.

Millionaire
11-15-2004, 09:47 AM
If you tell me which lines to change in which files, I can do it.

Mitch (Interspire Staff)
11-16-2004, 01:55 AM
Hi Millionaire,
It's quite a few lines (30+) so I'd prefer to do it for you as it'd be easier. Is it possible for me to do it?

Millionaire
11-17-2004, 04:13 AM
Thanks.

I prefer to edit myself so I know where to hack for future upgrades.

Suggestion: Why not include this as an option in the next update?

You can even give us option to select how many levels of categories to show.

1 level:
cat
- subcat

or 2 level:
cat
- subcat
-- 2nd level subcat

Another suggestion is to indicate the number of articles beside each cat and subcat. This is nice but not really important.

Mitch (Interspire Staff)
11-18-2004, 01:11 AM
Hi Millionaire,
As with all features, we'll be listing them and customers will be able to vote for them and the most popular features will make it in. I'm assuming this will be a popular feature though.

Edited By Jordie: I've updated the code as below in the next post.

I posted this customization as I think it will be useful to quite a few people, however from now on we'll be taking note of ideas for customizations for future product updates only.

Jordie (Interspire Staff)
02-15-2007, 02:20 AM
Hey guys,

Just an update on this one for a few people who have been having trouble because it relates to older code.

Same file: templates/[Your_Template]/Panels/RootArticleCategoriesPanel.php


Find:

while($catRow = mysql_fetch_array($catResult))
{

$output .= sprintf("

<div class=\"ListItem\">
<a href='%s'>
%s
</a>
</div>

", AL_HELPER::CategoryLink($catRow["CategoryID"], $catRow["Name"],false,true), $catRow["Name"]);
}


Now just before the closing } adding in this code:
// Start sub category mod
$query1 = sprintf("select * from %scategories where ParentID=%d order by Name asc", $GLOBALS["AL_CFG"]["tablePrefix"], $catRow["CategoryID"]);
$subResult = mysql_query($query1);

while($subRow = mysql_fetch_array($subResult))
{
$output .= sprintf'

<div class="ListItem" style="padding-left:20">
<A href="%s">
%s
</A>
</div>

', AL_HELPER::CategoryLink($subRow["CategoryID"], $subRow["Name"]), $subRow["Name"]);
}

// End sub category mod


So the whole thing now becomes:

while($catRow = mysql_fetch_array($catResult))
{

$output .= sprintf("

<div class=\"ListItem\">
<a href='%s'>
%s
</a>
</div>

", AL_HELPER::CategoryLink($catRow["CategoryID"], $catRow["Name"],false,true), $catRow["Name"]);
// Start sub category mod
$query1 = sprintf("select * from %scategories where ParentID=%d order by Name asc", $GLOBALS["AL_CFG"]["tablePrefix"], $catRow["CategoryID"]);
$subResult = mysql_query($query1);

while($subRow = mysql_fetch_array($subResult))
{
$output .= sprintf('

<div class="ListItem" style="padding-left:20">
<A href="%s">
%s
</A>
</div>

', AL_HELPER::CategoryLink($subRow["CategoryID"], $subRow["Name"]), $subRow["Name"]);
}

// End sub category mod
}

I hope that helps everyone!

Ramesh Srinivasan
03-09-2007, 01:51 PM
Hello AL Team!

Please update this thread (for Al-NX 1.7) when you have some free time.

Thanks

greateststrategies
03-27-2007, 06:16 PM
Are the code edits in this thread for older versions of articlelive?

I made the edits and got an error?

Thanks
Neil

Allan
03-28-2007, 01:10 AM
Are the code edits in this thread for older versions of articlelive?

I made the edits and got an error?

Thanks
Neil
Hi Neil,

Those modifications are for ArticleLive before 1.7. You will be able to do the same things that Jordie mentions above, but in a slightly different way in a different file.