Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-03-21 12:21:35
- guiguibonbon
- Member
- Registered: 2006-02-20
- Posts: 296
couple of suggestions on categories
I’ve been making this heavily categories-based website, which forced me to improve about every category-related function there is, for it to do things that seem very basic. Here are some of the things I think should be added to svn :
- txp:if_article_category should allow a list of categories in the name attribute. How stupid is this? (same goes for if_article_section btw)
- txp:category_list should set a category link as “active” when browsing one of that category’s child categories.
- an option should be set to treat articles whose categories have a parent category as if they were in that category (e.g. on the parent’s category listpage, articles with any of the child categories should also be displayed). The basic functions have already been written by Coke Harrington (chh_category_sql function in his article library)
If any of the devs want the code i’ve written, feel free to ask.
Last edited by guiguibonbon (2007-03-21 12:34:39)
Offline
Re: couple of suggestions on categories
- txp:if_article_category should allow a list of categories in the name attribute. How stupid is this? (same goes for if_article_section btw)
According to this post, txp:if_article_section
should accept multiple comma-separated values.
Offline
#3 2007-03-21 13:23:47
- guiguibonbon
- Member
- Registered: 2006-02-20
- Posts: 296
Re: couple of suggestions on categories
Good catch. One more reason to apply it to categories, be it for the sake of consistency. Here is how I rewrote it :
function if_article_category($atts, $thing)
{
global $thisarticle;
assert_article();
extract(lAtts(array(
'name' => '',
'number' => '',
),$atts));
if ($name) {
if ($number)
$bool = in_list($thisarticle['category' . $number], $name);
else
$bool = (in_list($thisarticle['category1'], $name) or in_list($thisarticle['category2'], $name));
return parse(EvalElse($thing, $bool));
} else
return parse(EvalElse($thing, (array_shift($cats) != '')));
}
Last edited by guiguibonbon (2007-03-21 14:09:29)
Offline
Re: couple of suggestions on categories
You could submit that as a .patch to the dev team.
Offline
Re: couple of suggestions on categories
Yes, please submit a patch, I’ve been waiting for this ability for a long time
[edit] Does somebody know of a good step-by-step tutorial on how to make and submit a patch? Checking the FAQ…
Last edited by mrdale (2007-03-21 15:28:46)
Offline
Re: couple of suggestions on categories
guiguibonbon wrote:
txp:category_list should set a category link as “active” when browsing one of that category’s child categories.
According to TextBook that’s already possible (active_class attribute)
Offline
#7 2007-03-21 15:52:07
- guiguibonbon
- Member
- Registered: 2006-02-20
- Posts: 296
Re: couple of suggestions on categories
mrdale wrote:
[edit] Does somebody know of a good step-by-step tutorial on how to make and submit a patch? Checking the FAQ…
Exactly. I have no idea how I’m supposed to make one.
ruude:
Yes but no. active_class only works on one level (if this is the category i’m browsing, mark as active). I’d like it to work like : “this is not the category i’m browsing, but the category i’m browsing is a child of this category, mark as active”
if i have this cat. tree :
- fruits
- apples
- kiwis
- vegetables
- potatoes
if I’m browsing kiwis, i’d like both kiwis and fruits to be marked as active.
Offline
Re: couple of suggestions on categories
mrdale wrote:
[edit] Does somebody know of a good step-by-step tutorial on how to make and submit a patch? Checking the FAQ…
If you are already using subversion making a patch is dirt simple. You make your changes in your working copy and then tell SVN to store it as a patch. You then send it to the dev list.
Creating a patch using TortoiseSVN
Creating a patch file using command line SVN:
svn diff > patchfile.patch
If you aren’t using Subversion yet Textbook as whole section on it
Ok that’s not quite step by step.
Shoving is the answer – pusher robot
Offline
Re: couple of suggestions on categories
Ok, here’s a patch
Everyone want to test it, I’ll submit it.
Offline
#10 2007-03-26 11:47:27
- guiguibonbon
- Member
- Registered: 2006-02-20
- Posts: 296
Re: couple of suggestions on categories
Any news from the dev on this?
Offline
Re: couple of suggestions on categories
Posting the patch to the txp-dev mailing list might draw some attention.
Offline
#12 2007-03-27 02:42:31
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: couple of suggestions on categories
The idea is to move towards more than 2 categories per article, which is why the function is structured as it is. Try out r2262.
Offline