Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-03-01 22:50:06
- seth.aldridge
- New Member
- Registered: 2008-03-01
- Posts: 5
Limiting the Characters
Hi,
I am looking to limit the amount of characters for the body post. I installed the plug-in sab_substr to do this, but it didn’t work…at all.
Does anyone know of a better/built-in way to do such a simple task?
Thanks,
Seth
Offline
Re: Limiting the Characters
Do you want to limit the length of the actual article or just limit the length output to the screen? I’ve no idea about the first option but you can use the rss_auto_excerpt plug-in for the second option. Limits by character, word or paragraph.
Last edited by thebombsite (2008-03-01 23:10:54)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#3 2008-03-01 23:30:35
- seth.aldridge
- New Member
- Registered: 2008-03-01
- Posts: 5
Re: Limiting the Characters
How do you format the tags to do that? Looking over the examples it doesn’t look like you can limit the text after it’s entered.
We need different lengths for different areas of the site, but ultimately we need to be able to input as many characters as we can and then limit them as we call them on the page itself.
Offline
Re: Limiting the Characters
As Stuart said, rss_auto_excerpt (see link for full details of tag notation and attributes) will allow you to truncate the excerpt to a given length (no. of characters, no. of words, no. of paragraphs) and will neatly close any tags in the text (e.g. bold, italic etc.) that happen might still be open when output was halted (so it doesn’t affect the rest of your page). This and other similar plugins don’t limit how much you can enter in the txp back-end, just how much appears.
If you want to limit the number of characters in the backend you could modify the database tables using phpmysqladmin from mediumtext
to varchar
and the number of characters (see the custom fields for an example of notation, they are limited to 255 chars). Don’t be surprised if people don’t take too kindly to it – it will take the first x characters that you type in and ditch the rest irrecoverably without warning.
TXP Builders – finely-crafted code, design and txp
Online
#5 2008-03-01 23:53:29
- seth.aldridge
- New Member
- Registered: 2008-03-01
- Posts: 5
Re: Limiting the Characters
At the risk of sounding like an idiot is there any way you can provide me with a sample snippet of code that works for you? I’ve tried adding it to every place I can think of and nothing changes. I’ve read over their documentation several times to see what it is that I’m missing and I can’t seem to locate anything.
<txp:rss_auto_excerpt words="100" />
Currently I have the above code in the Page area…any help would be greatly appreciated.
Last edited by seth.aldridge (2008-03-01 23:54:14)
Offline
Re: Limiting the Characters
You put it in an article form (presentation tab > forms save as new form, type article). Then you call it in your page template using txp:article(_custom), txp:recent_articles etc. Basically you use it as your would txp:excerpt.
EDIT: here’s a usage example in the forum thread on the plugin.
Last edited by jakob (2008-03-02 00:26:13)
TXP Builders – finely-crafted code, design and txp
Online
Pages: 1