Textpattern Forum

You are not logged in. Register | Login | Help

#1 2004-06-22 19:27:27

Sencer
Developer emeritus
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

asy_category_tags - Some additional category Tags

This was written in response to this discussion:
http://forum.textpattern.com/viewtopic.php?id=2377

1) Article-Form-Tag: Shows Categories, if they are set. (can only be used in an article form)
<:txp:asy_showcat link=“true /> link is optional. If the article has categories set, this will output
a text like (filed under catName). If link is set to true, catName will be a (section-aware) link.

2) Page-Tag: Show all categories of current section that have articles in them.
<:txp:asy_category_list label=“Some free text” wraptag=“p” break=“br” /> All attributes are optional.

3) Page-Tag: Show all categories of current section that have articles in them. (popup)
<:txp:asy_category_popup label=“Some free text” wraptag=“p” break=“br” /> All attributes are optional.

<strike>Version: 0.5 Date: 22.06.04
Version 0.6 Date: 24.06.04
Version 0.65 Date: 26.06.04</strike>

Version 0.7
Date: 27.06.04

Note: Since there is no clearly defined API, these funxtions tap into some global variables ($thisarticle, $pfr, $url_mode) , which theoretically could change in the future. This version was tested with g1.19, and there is a small possibility this may not work as is in future releases.

Download: http://www.sencer.de/code/asy_category_tags.txt

Have Fun.

Last edited by Sencer (2004-06-27 09:31:21)

Offline

#2 2004-06-24 20:13:21

Sencer
Developer emeritus
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: asy_category_tags - Some additional category Tags

Fixed a bug in the previous version (hardcoded section-name).

Added 3rd tag: txp:asy_category_popup

Offline

#3 2004-06-25 09:22:26

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,388
Website

Re: asy_category_tags - Some additional category Tags

Sencer, I can use your asy_showcat tag because with txp:category1 and 2 I found that it shows only the first word of a category that has a three word name (say: nuts & bolts) when link was set to “1”. Your tag shows the complete category name, and only if a category is set, which is great, but now I have another problem: when setting link to true, the output is nuts & a m p ; bolts (without the spaces of course but otherwise it won’t show here). I don’t want to change it back to just & because I want to have valid xhtml.
Is there a way to solve this?

Thanks.

Last edited by doggiez (2004-06-25 09:30:28)


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#4 2004-06-25 10:09:19

Sencer
Developer emeritus
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: asy_category_tags - Some additional category Tags

Hi doggiez,

I myself have a category that is named “Tools & SW”, and the pages validate just fine. That’s of course because every place that I output the category-name I convert it. If I am not mistaken, that is how Dean does it with the categories too (at least in g1.19).

Re: Your problem: Would changing the name to “nuts & bolts” and re-checking all the places where you output the category-name be an option?

Offline

#5 2004-06-25 16:20:15

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,388
Website

Re: asy_category_tags - Some additional category Tags

O.k. I changed it and it still validates. It’s not errors that I get but warnings: “character “&” is the first character of a delimiter but occurred as data”. I can live with that ;-)

Thank you for your answer.


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#6 2004-06-26 20:26:46

fri
Member
From: Denmark
Registered: 2004-04-30
Posts: 34
Website

Re: asy_category_tags - Some additional category Tags

Thank you so mutch for the popup-part, Sencer!

Any chance it could be made to work with messy urls as well?

when I click on a category, the url goes: <code> /rootfolder/s=sectionname?c=categoryname </code>

The questionmark is displayed immediately before the select-name. It seems the select-name has to contain the whole url-bit, or??
(That is also why I couldn’t get it to work if I handcoded the popupmenus.)

I have to use messy urls for the time beeing, in order to make the section-popup work, among other reasons. That’s why it would be great for me, if it’s not too mutch work for you.
Again – thank you.

Last edited by fri (2004-06-26 20:29:28)

Offline

#7 2004-06-26 21:51:00

Sencer
Developer emeritus
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: asy_category_tags - Some additional category Tags

Hi fri,

I coded with messz urls in mind, but I made a little ommission.

Anzwaz I hope I fixed the bug now. Updated to version/number 0.65< I can|t test right now. I hope it works now…

Offline

#8 2004-06-27 03:34:55

fri
Member
From: Denmark
Registered: 2004-04-30
Posts: 34
Website

Re: asy_category_tags - Some additional category Tags

Thanks, Sencer, but it doesn’t work…
Are you still on for a version 0.7?

It seems that as soon as the url from the form-tag gets a question mark, it is overridden by the somehow encoded url in the select-name.

Result: only “?c=categoryname” – section gets ‘eaten up’.

I tryed to put it all in the select-name like this:

<code>$out =’<select name=“s=’.$s.a.‘c” onchange=“submit(this.form)”>’.n.t.’<option value=”“></option>’.n;</code>
because that displays the correct ‘grammar’ of:
/?s=section&c=category,
but then I end up with the mumblejumbled “=” and “&” beeing displayed as “%3D” and such.

I’m sorry it has to be such a pain!
You think it can be fixed?

Offline

#9 2004-06-27 09:30:48

Sencer
Developer emeritus
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: asy_category_tags - Some additional category Tags

Hi fri,

now I really fixed it (and tested it ;) ).

I am passing the section as a hidden input in the form. Since the form method is GET appending to the URL didn’t work (It works with POST though; that’s why I remembered it wrong).

Have fun. Updated to 0.7

Offline

#10 2004-06-27 13:19:09

fri
Member
From: Denmark
Registered: 2004-04-30
Posts: 34
Website

Re: asy_category_tags - Some additional category Tags

Hurrah for you and for your hidden values!
Thank you so mutch, for this and for taking it up in the first place.
That is what I needed – I will be able to move on now!

Offline

Board footer

Powered by FluxBB