Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-02-05 12:20:28

Saigo
Member
Registered: 2005-01-02
Posts: 60
Website

chh_article_custom: lphabetical listing, while omitting "A, An, The"?

My code in the form movies_alphabetical has the following:

<txp:if_different><h3><txp:php>echo substr(title(array()), 0, 1);</txp:php></h3></txp:if_different>

while my list page has the following code:

<txp:chh_article_custom limit=99999 sortby="SmartTitle" sortdir="asc" listform="movies_alphabetical" />

I obtained the PHP code from Mary in one of the topics here – I’m not a coder so I don’t exactly know what it meant but it does what I want it to do, like this:

A
Apple
Alicia
Arise

B
Baseball
Batting
Bee

As you can see, I’m using chh_article_custom plugin, which is supposed to do a ‘smart’ alphabetizing (that is, alphabetize accordingly while ignoring ‘a, an, the’) of the list of articles I am to have. It works, but, when combined with the above PHP code, it has jumbled up, in which you can see in this page.

“The Pursuit of Happyness” is now placed before S, and should be under P itself, but because of the PHP code, it has now created the heading “T” and placed itself beneath P. Is there a way to make it so that “The Pursuit of Happyness” is placed under P together with “Poseidon”, so that it will not create “T” all by itself?

It’s more of an aesthetics quirk rather than anything, but I really will appreciate any help!

(Edit: updated discussion topic. -Mary)

Last edited by Mary (2007-02-08 02:23:31)

Offline

#2 2007-02-06 02:02:55

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: chh_article_custom: lphabetical listing, while omitting "A, An, The"?

SmartTitle is not an available sorting column.

Offline

#3 2007-02-06 03:16:04

Saigo
Member
Registered: 2005-01-02
Posts: 60
Website

Re: chh_article_custom: lphabetical listing, while omitting "A, An, The"?

What do you mean by that? SmartTitle is actually chh_article_custom’s custom value, which I have used.

Offline

#4 2007-02-08 02:22:43

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: chh_article_custom: lphabetical listing, while omitting "A, An, The"?

Nevermind. :)

Offline

#5 2007-02-08 14:00:19

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: chh_article_custom: lphabetical listing, while omitting "A, An, The"?

This might work:

<txp:if_different><h3><txp:php>
  echo substr(preg_replace('/^(a|an|the)\s)/i','',title(array())), 0, 1);
</txp:php></h3></txp:if_different>

Last edited by ruud (2007-02-08 14:02:11)

Offline

Board footer

Powered by FluxBB