Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#289 2009-11-14 14:54:28
Re: [Archived] stw_category_tree
I’m running 4.2, working other than the issues I’m having above and below.
The killempties
attribute has an odd behavior, not sure if it’s as intended. It does hide categories that are “top-level” with no child categories in them, but shouldn’t it display them if there are articles assigned to them? When I set count="1"
, any categories with articles assigned show up, while those without stay hidden. This is better, but actually I think any category (parent or “empty top-level”) should be hiddene is there are no articles assigned to it. Bug?
Another thing, even when I set the section
attribute, if I use stw_category_tree in a different section, it is ignoring that attribute and just makes all the links relative to the current section.
Last edited by aswihart (2009-11-14 15:56:57)
Offline
#290 2010-03-09 16:57:13
- vickilh
- Member
- Registered: 2007-10-30
- Posts: 96
Re: [Archived] stw_category_tree
I’ve upgraded to 4.2 but still have stw_category_tree version 0.4 running. I’d like to upgrade the plugin to version 1.0.1. I installed it on our test site and see some problems.
The first problem I’d like to get out of the way is the the plugin is no longer stripping the numeric prefixes off the category name (used for ordering). I looked at the 1.0.1 code and don’t see anything doing this. — Was this removed? If yes, what can I add to the plugin code to get it to strip off numeric prefixes again?
Thanks!! Vicki
Offline
#291 2010-03-10 22:52:13
- vickilh
- Member
- Registered: 2007-10-30
- Posts: 96
Re: [Archived] stw_category_tree
Ok, I’ve figured out the problem of stripping off the numerics. Add these 2 lines to this section:
// BUILD THE TEXT OF THE CATEGORY LINK $newname=smd_strip_numerics($title); $title=$newname;And add this function:
// Strips out numbers at beginning (hack allows for custom sort order)
// Items must be in format: ’1. Item’, ’2. Item’, ’10. Item’
function smd_strip_numerics($name) {
// ^([0-9]+)\.
$newname2 = ereg_replace(“^[0-9]+\. “, “”, $name);
$newname1 = ereg_replace(“^[0-9]+\-”, “”, $newname2);
$newname = str_replace(“-”, “ “, $newname1);
return $newname;
}
— Now, next problem. For some reason, it seems that the plugin is now ignored my .htaccess. It is no longer leaving off the “index.php” in the url. (I am using “messy” urls.)
Any ideas about this problem? Thanks! Vicki
Offline
#292 2010-03-11 15:45:24
- vickilh
- Member
- Registered: 2007-10-30
- Posts: 96
Re: [Archived] stw_category_tree
I’m just going to forget about version 1.01, – I don’t need the ‘clean url’ feature anyway. — I’ll be using version 0.6.1, it meets my needs.
Best, vicki
Offline
#293 2010-04-08 08:07:08
- bmwg
- Member
- Registered: 2010-04-06
- Posts: 39
Re: [Archived] stw_category_tree
I have 4 lists on my start page which is the default section. List 1-3 are the 3 main product groups with their subproducts listed underneath and list4 is filled with about, references, ..
Product group 1:
<txp:stw_category_tree start="productGroup1" maxlevel="1" section="products"/>
Maxlevel is to avoid showing subProducts on the start page.
Now if I click on product1 in the productGroup1 list I get to my products section. Here I want to show 2 lists. 1 with all the products of productGroup1 with product1 active (since this was the link I clicked on the startpage). And another list with the subProducts of the active product.
How would I do that?
Right now i have <txp:stw_category_tree start="*" />
which gives me the subProducts. But as soon as I click on a subProduct, the list gets empty because it tries to fill in subSubProducts (which don’t exist).
My question is: how do I get lists on an absolute level in the hierarchy? So that list1 always displays the (right) 2nd level of my category tree (absolute, the 2nd level from the root) and list2 always displays the right 3rd level of my category tree (if something is selected on the 2nd level)?
Offline
#294 2010-11-11 13:18:19
Re: [Archived] stw_category_tree
About strange output un the top of code – go to line ~#235 and comment out or delete this string
dmp($cat . ", " . $type);
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
#295 2012-08-14 00:42:18
- gfdesign
- Member
- From: Argentina
- Registered: 2009-04-20
- Posts: 401
Re: [Archived] stw_category_tree
Hi Santheo. I’ve been using your plugin since a long while. I was wondering, have you found out how to use the plugin in an individual article? I want that “active” class not dissapear when you are in one.
Looking forward for your reply.
Many thanks!
Offline
#296 2012-08-19 20:10:48
- gfdesign
- Member
- From: Argentina
- Registered: 2009-04-20
- Posts: 401
Re: [Archived] stw_category_tree
Anton wrote:
Is there any way I could make this plugin show the current category when viewing an individual article? In this case I guess the current category is not the value of the ?c= parameter but the value in the database entry for the selected article.
santheo dijo:
Alas, this is more difficult that I thought. Because the stw_category_tree tag is called from within a page, and not an article form, it doesn’t seem to “know” anything about the current article. If anyone has any advice on how to determine the current category, I’d be interested in hearing it.
I could do it using Jquery. This is the code:
<txp:if_individual_article>
<script type="text/javascript">
$(document).ready(function(){
$('.list01').html($('.list01').html().replace('<li id="cat-<txp:category1 title='0' />">', '<li id="cat-<txp:category1 title='0' />" class="active">'));
});
</script>
</txp:if_individual_article>
What I did was to add class “active” inline when <li> tag belongs to [stw_category_tree] output matchs with the current category of the article,
Some aditional comments.
list01
: ID or class that wraps [stw_category_tree] output.
active
: the class that must be match with the indicate with [stw_category_tree] parameter onclass
I hope this serves somebody else.
Regards
Offline