Plugin: tag_limit
Posted: 08 May 2006 07:27 AM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006

Tag Limit enables you to take html and show only certain tags. for example a <p>... </p>.

Parameters

tag - the tag you wish to show. (default p)
num - the number of tags to show. (default 1)
offset - offset the first result returned by given amount, if the offset os greater than the number of matching tags you will get nothing returned.
class - search for only tags with a certain class.
id - same as class but by id.
show_tags - ‘off’ will return the match without encasing tags, on will return them. (off or on, default is on)
word_limit - limits the word total of the returned data. This can be set to limit on each tag found, should you set ‘num’ to greater than 1, or on the output as a whole, using the below parameter.
limit_style - (each or all, default each)

Example usage

Imagine this is your content (please note duplicate id references are invalid in xhtml)

<p>paragraph 1</p>
<
p class="foo">paragraph 1 with class foo</p>
<
p id="bar">paragraph 1 with id bar</p>
<
p>paragraph 2</p>
<
p class="foo">paragraph 2 with class foo</p>
<
p id="bar">paragraph 2 with id bar</p>
<
p>paragraph 3</p>
<
p class="foo">paragraph 3 with class foo</p>
<
p id="bar">paragraph 3 with id bar</p>
<
p>paragraph 4</p>
<
p class="foo">paragraph 4 with class foo</p>
<
p id="bar">paragraph 4 with id bar</p>
<
p>paragraph 5</p>
<
p class="foo">paragraph 5 with class foo</p>
<
p id="bar">paragraph 5 with id bar</p>

Using these tag parameters

{exp:tag_limit tag="p" class="foo" num="2" offset="2"}


You will get

<p class="foo">paragraph 3 with class foo</p>
<
p class="foo">paragraph 4 with class foo</p>

The word limiter functionality comes from EE’s built in word_limit function, so remains the same issues with leaving tags open as with the official word_limit plugin.

You can use class and id together if you so wish, there is no set order that the two parameters need to be (within the html tag).

Current version: 1.3.1

File Attachments
pi.tag_limit.txt  (File Size: 5KB - Downloads: 246)
 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 08 May 2006 08:35 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
RankRankRank
Total Posts:  547
Joined  01-05-2005

That’s cool.  What would also be useful would be the ability to take everything but the first paragraph.  You could then insert content between the two.

 Signature 

Celebrating again soon.

Profile
 
 
Posted: 08 May 2006 08:53 AM   [ Ignore ]   [ # 2 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006
smallbeer - 08 May 2006 08:35 AM

That’s cool.  What would also be useful would be the ability to take everything but the first paragraph.  You could then insert content between the two.

Indeed that would be kinda cool, one way you could do it is just give the first paragraph in your entry a class/id different to that of the 2nd/3rd/4th paragraph etc. Or use custom fields in your blog smile

 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 25 October 2006 03:39 AM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006

1.2

- With need for dragging out single tags like img, comments, etc i have gone and updated this plugin.

As always please test and mail me bugs.

 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 06 March 2007 06:39 AM   [ Ignore ]   [ # 4 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006

1.3

- Updated the plugin to make it a bit leaner, and cleaner.  Also rewritten the first post to explain some the new added functionality.

 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 07 March 2007 07:54 AM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006

1.3.1

- Fixed a bug with ‘show_tags’ set to ‘on’ that was letting the plugin return all tagdata rather than suitable matches

- Added ‘offset’ parameter to allow results starting beyond the first match.

 Signature 

(a.k.a the_butcher)

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64529 Total Logged-in Users: 28
Total Topics: 81096 Total Anonymous Users: 23
Total Replies: 436396 Total Guests: 247
Total Posts: 517492    
Members ( View Memberlist )