Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-08-11 22:32:30

stevieg_83
Member
From: Glasgow, UK
Registered: 2009-07-24
Posts: 14
Website

stripping html tags and limiting output of words

Is it normal for newbies to have so many questions?

I’m actually surprised at how much I’ve managed to get done thus far in TXP.

OK – I created a section called testimonials to display on my homepage. The title takes the client’s name, excerpt takes the client’s job title and body take’s the quote.

My custom form is like this

<div class="quote">

<txp:article_image thumbnail="0" />

	<div class="blockquote">
		<p class="authorname"><txp:title /></p>
		<p class="authortitle"><txp:excerpt /></p>
		<p class="testimonial"><txp:body /></p>
	</div> <!-- end blockquote -->
<!-- end quote-->
</div>

Which in turn produces

<p class="authorname">Mark Schenk</p>
		<p class="authortitle">	<p>Pastor, Duncan Street Baptist</p></p>
		<p class="testimonial">	<p>“Steven’s a committed designer who understands what churches need to be successful online”</p></p>

How can I strip the p tags inside my p tag with class applied?

Another issue I have on my homepage is that I only want to display so many words from my client and blog section. I know I could just limit what I type in the excerpt but wondered if there was a plugin that would limit the number of words from an article?

(edited for better code display. -Els)

Last edited by els (2009-08-11 22:53:19)

Offline

#2 2009-08-11 23:06:23

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: stripping html tags and limiting output of words

stevieg_83 wrote:

Is it normal for newbies to have so many questions?

It’s not unusual :)

How can I strip the p tags inside my p tag with class applied?

Textile adds the <p> tags around the body and excerpt. You can turn Textile off (either on a per article basis in the ‘Write’ screen under ‘Advanced options’ or for all articles in Preferences) or use for example <div>s in your form instead.

Another issue I have on my homepage is that I only want to display so many words from my client and blog section. I know I could just limit what I type in the excerpt but wondered if there was a plugin that would limit the number of words from an article?

Plugin: rss_auto_excerpt.

(How do I post tags and code on the forum?)

Offline

#3 2009-08-12 12:45:28

stevieg_83
Member
From: Glasgow, UK
Registered: 2009-07-24
Posts: 14
Website

Re: stripping html tags and limiting output of words

Thanks Els.

Much appreciated. Got the html stripping but not having so much luck with the rss_auto_excerpt plugin. Is this something you’ve used before and could help me with?

Offline

#4 2009-08-12 18:01:04

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

Re: stripping html tags and limiting output of words

rss_auto_excerpt is documented here

I think you’ll want to use it like this (10 word excerpt without a “read more” link and without HTML tags):

<txp:rss_auto_excerpt words="10" showlinkwithexcerpt="0" striptags="1" />

Offline

Board footer

Powered by FluxBB