Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Style part of an article title
The other option would be, of course, to dirify by hand: enter a properly compliant title in the title field; enter the title as you want it styled, wrapped in a header tag, in the body of the article; and set your page templates not to display the title field in the body, just the article itself.
(Added: or one of the alternate content fields? Copy the contents of title to a new field in the database, and use that? But I’d still have to dirify the titles by hand to strip out the crap…)
But holy Mary Mother of God, I’ve got 800+ posts to check and load.
—Does anyone have a copy of 4.0.1 sitting around I could borrow?
Last edited by kiplet (2006-01-29 17:50:19)
Offline
Re: Style part of an article title
Okay: just wanted to update this a bit with the solution I’ve come to, which, yes, is work, work I didn’t want to do, but. First, though, I wanted to clip something I saw quoted elsewhere:
I often want TXP to do something automatically but then when I step back and try to figure out how to do it TXP’s way I realize that it’s almost always a more flexible and better solution.
That’s neutrino, over in <a href=“http://forum.textpattern.com/viewtopic.php?id=13542”>this thread</a>, which has an amusing line comparing Drupal to an ATV, but anyway, as a Textpattern noob, I’m sticking that to the wall or something. Yes, what I’ve come up with requires precisely the work I was whingeing about before, but in the end I’ll have something as flexible as I wanted and moreso.
Anyway: the solution.
I renamed one of the custom fields to title_typog, since that was clear enough for my purposes. Then I copied the fully marked-up version of the title to that field, and stripped markup out of the title stored in title. Then, in the various article forms, I went hunting for the following code:
<code><txp:title /></code>
And replaced it with this:
<code><txp:if_custom_field name=“title_typog”>
<txp:custom_field name=“title_typog” />
<txp:else />
<txp:title />
</txp:if_custom_field></code>
That checks to see if there’s a value in title_typog, and uses that value if there is, and if not reverts to title.
One of the benefits I hadn’t stopped to think of in doing it this way is I want some archive pages to list article titles in a particular list-like fashion, which wouldn’t work with the punctuation I usually use at the end of article titles. This way, I can use the value stored in title for that list, and the value stored in title_typog when it needs to be all shiny and pretty.
Which, forgive me if I’ve gone on too long about something that seems simple enough on the face of it, but: important truth learned. Stop and think and see what you can do with the tools at hand, I guess. (Yes it would be nice to set this up automagically, but truth be told I’d get in there and muck with the resulting titles manually anyway, most like.)
One downside: unicode entered into a custom field saves properly to the database, but if the article is brought up again, that unicode is converted to its “proper” character—&#8217; becomes ’ and when you save the article a second time, the ’ replaces the &#8217; in the database. Which is annoying. But.
Offline
Re: Style part of an article title
BIG thank kiplet, You help me a lot.
BR
Pedronx
Offline