You are not logged in.
I am using this code to output a menu that lists articles by category. I know that, upon installation, stw_category_tree created a field in the database so that the categories can be ordered. I’m curious if it is possible to use something like <txp:article_custom sort=“field(’ ‘, …) to list the articles by category in the stw_category order? I got the idea that it might be possible by reading this thread.
[Edit] Ok… I think what I really need is a different plugin – a “companion” plugin for stw_category_tree. It would function just like txp:article_custom, but allow a way to sort articles by Category1 or Category2 using the order set by stw_category_tree in the Menu Control extension tab. I am not a real programmer, so I have no clue how article_custom would be able to access the idx field in the txp_category table. I’ll post this in the plugin request area, but thought I’d update this post in case anyone else is interested.
SOLUTION:
jsoo helped me use the smd_query plugin and the article_custom tag to sort articles with the stw_category_tree menu order:
<txp:article_custom sort='field(ID, <txp:smd_query query="select textpattern.ID from textpattern left join txp_category on category1 = name order by idx" break=",">{ID}</txp:smd_query>)' />
Last edited by photonomad (2009-07-28 03:19:26)
Offline
I’m having the same problem that mericson stated on the previous page
I want:
http://www.mysite.org/bar/?c=baz
But I get:
http://www.mysite.org/category/baz/
section/category links do not work
lee also pointed out the problem here
Paul said it was fixed here and offered a download with the fix.
There is mention of version 1a.2 but the links lead to a page with only downloads for v1.1
Can anyone out there point me to version 1a.2? Or, does anyone know of a fix for the section/category link problem? Thanks!
Last edited by photonomad (2009-08-14 22:24:17)
Offline
stw_category_tree works, but displays errors now that I have upgraded from 4.0.8 to 4.2.0.
———————————————————————-
This is the error I am getting (at the top of the Menu Control page) after I click SAVE CHANGES:
Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1 update txp_category set idx = 0 where id = in /sitedirectorypath/textpattern/lib/txplib_db.php on line 85
The same error displays 22 times (idx = from 0 to 22), then the following:
Warning: Unknown column ‘view’ in ‘where clause’ update txp_category set idx = 23 where id = view-site in /sitedirectorypath/textpattern/lib/txplib_db.php on line 85
Warning: Unknown column ‘logout’ in ‘where clause’ update txp_category set idx = 24 where id = logout in /sitedirectorypath/textpattern/lib/txplib_db.php on line 85
New menu order saved successfully.
———————————————————————-
The plugin still functions, but would love for all of the errors to disappear. Not sure if this is an easy fix or something more complicated. Anyone else experiencing this?
Offline
I have no idea why, but I get all my categories listed with pre tags at the very beginning of my page (even before doctype declaration), then down where I inserted the tag <txp:stw_category_tree count="1" killempties="1" /> it displays the output you would expect.
This is what I see at the very top of the page with “view source”:
<pre>
breast-imaging, article
</pre>
<pre>
cardiac, article
</pre>
<pre>
chest, article
</pre>
<pre>
gastrointestinal, article
</pre>
<pre>
genitourinary, article
</pre>...etc, etc, etc...
Fixing this currently by brute force with pre { display: none; }
Last edited by aswihart (2009-11-14 14:55:14)
Offline
anyone having luck with this plugin and TXP 4.2?
Offline
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
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
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
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
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