Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Case-sensitivity categories
After pulling my hair out a several times why my beautiful forms weren’t working, I discovered that the handling of names of categories is inconsistent. An example:
<txp:if_category name="Text">bla bla bla</txp:if_category>
doesn’t output the bla bla bla, although I named the category ‘Text’ (pay attention to the capital T).
The following does work, even though I used a capital T under the Categories-tab.
<txp:if_category name="text">bla bla bla</txp:if_category>
Is this a bug?
…Prrrrrrrr…
Offline
Re: Case-sensitivity categories
This dempends on two things.
- Is your db cs(case sensitive)?
- Category title might be in capitals (this appears on the front end), category name is normally lower case (this appears in the url)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Online
Re: Case-sensitivity categories
TNT wrote:
the handling of names of categories is inconsistent
It’s not a bug. Category names are generated from whatever you type at creation time. As colak says, since they are used in URLs, the names have to be sanitized for correct web URL usage. Thus spaces become hyphens, ‘odd’ characters like apostrophes and accents are ignored and whatever you type is converted to lower case (for consistencies sake).
So now it is actually very consistent, it’s just not consistent with what you typed! Check the Categories tab and click one of your cats to see the name that you should use in all relevant tags.
Textbook is, however, a little nebulous on this matter so I’m just going through and making it more explicit.
Last edited by Bloke (2009-09-16 11:32:01)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Case-sensitivity categories
I think it’s relatively easy to make the categories and sections in URLs case sensitive. If the URL is treated case sensitive, then you’ll never have 2 different URLs (differing in case only) that point to the same page.
The way we store the categories/section in MySQL, it is treated as a case-insensitive string when doing a query, but if you fetch the actual category/section from the database, you do see how it was originally entered and can compare it to what’s in the URL… and decide to reject it because the case differs.
[note that if url handling was case sensitive, that doesn’t necessarily mean it’s possible to have two categories “Test” and “test” as completely separate categories.]
Offline
Re: Case-sensitivity categories
OK, I understand. But I’m wondering why the conversion to lower case is also done inside forms. That’s what was causing me headaches (and bold spots on my head… ;-)
…Prrrrrrrr…
Offline
Re: Case-sensitivity categories
Hi Arjan,
If by forms you mean tha category tag, it is because it requires the name
not the title
of the category
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Online
Re: Case-sensitivity categories
I’ve updated all the textbook tags that use category
to explicitly mention the fact they need to be lower case names not titles that you may have typed. I’ve also updated the Admin Side -> Categories page to mention the fact that the Title you type is converted to lower case to create the category name when you hit the Create button.
As colak implies, the conversion to lower case is done at category create time. From that point on you always refer to the category using its name, not Title in TXP tags. Umm, I hope!
(go to the Categories tab and add an Article Category called Mr O'Flannery
; note that TXP reports Article category mr-oflannery created.
)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Pages: 1