1 of 2
1
Limiting number of characters using Word Limit Plus
Posted: 24 July 2008 09:41 PM   [ Ignore ]  
Summer Student
Total Posts:  24
Joined  07-12-2008

Is it possible to limit words (using the Word Limit Plus plugin) inside of an embed?  I’ve been trying to get this to work and it’s not happening for me.

code:

<div id="smallstory">
{exp:weblog:entries weblog="Journal" category="11" limit="1"}
<a href="#" class="highlightit">
<
div class="inside">
<
h5 class="feature">{title}</h5>
{exp:word_limit_plus if_exceeds="50" stop_after="40" the_link="<a >MORE...</a>"}
                                                                                                        
{journal_intro}
{
/exp:word_limit_plus}

<div class="date">Posted on {entry_date format="%M %d, %Y - %h:%i %A"}</div>
</
div>
</
a>
{/exp:weblog:entries}

</div>

Any ideas?

Profile
 
 
Posted: 25 July 2008 08:42 AM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

This should work.  How are you embedding it?  In other words, what does your {embed….} look like?

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 25 July 2008 09:10 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  24
Joined  07-12-2008

On my index page I have:

<div id="content75">
<
div class="inside">
                                         
{embed="grey-embeds/front_stories"}

</div>
</
div>

In which inside of the front_stories template I have the code above.  This is the only embed I’ve done.

Profile
 
 
Posted: 25 July 2008 09:21 AM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

Can you post a link to your page?

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 25 July 2008 09:27 AM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  24
Joined  07-12-2008

sure. I sent it via pm.

Profile
 
 
Posted: 25 July 2008 09:59 AM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

Thanks. 

This is unrelated, but I highly recommend you declare a DOCTYPE in your markup. 

Everything looks fine, but I noticed you had a special character here:

{... the_link="<a >MORE...</a>"}
here
-------------------------^

The last ” after your link

</a>” <—-this

  Which you’ve since removed or edited in this post.  I’d check that out because that may cause it to parse improperly.

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 25 July 2008 10:42 AM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  24
Joined  07-12-2008

Thanks for the DOCTYPE reminder and your help.  It’s still not working right, though.  Have any ideas on how to accomplish what I’m trying to do (even if it means doing it without this plugin)?

Profile
 
 
Posted: 25 July 2008 12:17 PM   [ Ignore ]   [ # 7 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

What does it do when you just place the guts of the embed code on your template?  Or better yet, why not just place the guts of your embed code on your template?  smile

I tested your same setup in my environment (to make sure) and it works fine; in and outside of the embed.

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 25 July 2008 01:23 PM   [ Ignore ]   [ # 8 ]  
Summer Student
Total Posts:  24
Joined  07-12-2008

Actually, I’m a rookie at this thing, just trying to piece this thing together as I go along.  Some website told me to organize everything in embeds - I guess, just to keep things organized. 

I tried taking the “guts” out of the embeds and putting them back directly in the templates but I’m still getting the same results. 

Is there any admin settings I could have set that is turning my plugin off by default or something?

Profile
 
 
Posted: 25 July 2008 01:48 PM   [ Ignore ]   [ # 9 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

Nope, is a plug-in so it works right a way.  Your missing something… 

Did you install the plug-in?  Meaning, did you upload the pi.word_limit_plus.php file to your plugins directory?

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 25 July 2008 02:02 PM   [ Ignore ]   [ # 10 ]  
Summer Student
Total Posts:  24
Joined  07-12-2008

No, I just went to Admin > Utilities > Plugin Manager > and clicked Install for the Word Limiter Plus.

Profile
 
 
Posted: 25 July 2008 02:15 PM   [ Ignore ]   [ # 11 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

Another dumb question, is what you’re limiting have more than 50 words?  Try changing it to:

if_exceeds="5" stop_after="3"

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 25 July 2008 02:29 PM   [ Ignore ]   [ # 12 ]  
Summer Student
Total Posts:  24
Joined  07-12-2008

Thanks to you having me look at that line! I was using a href to highlight my div but then there’s the a href for the Read More link… can’t put an <a > inside of another <a >... HTML 101…

Sorry about that.

Thanks again!

Profile
 
 
Posted: 25 July 2008 02:35 PM   [ Ignore ]   [ # 13 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

ohh Deep.  LOL!

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 29 July 2008 10:10 AM   [ Ignore ]   [ # 14 ]  
Summer Student
Total Posts:  24
Joined  07-12-2008

OK, so I fixed the obvious simple blunder, but I’m still stuck.  Though it works (limits the words) it breaks the CSS in my page in Firefox. I tried using the Word Limit plugin (the one without the link) and and the Word Limit Plus plugin (with the link parameter taken out) and I get the same effect - it seems like it makes the display:block setting for each variable now instead of just the main one surrounding everything.

Go to terenceflowers.net to see what I’m talking about.  All the other stories in the main section are without the Word Limiter plugin expressions the 1st one is the only one that has it.  By the way, everything looks OK in IE7. 

This is what I have now:

<div id="smallstory">
{exp:weblog:entries weblog="Journal" category="11" limit="1"}
<a href="#" class="highlightit">
<
div class="inside">
<
h5 class="feature">{title}</h5>
{exp:word_limit total="20"}

{journal_intro}

{
/exp:word_limit}
                                                                                                    
<div class="date">Posted on {entry_date format="%M %d, %Y - %h:%i %A"}</div>
</
div>
</
a>
                                          
{/exp:weblog:entries}
                                                                            
</div>

Why would a plugin change CSS?  Any ideas?

tlflow

Profile
 
 
Posted: 29 July 2008 10:18 AM   [ Ignore ]   [ # 15 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

Firefox is a standards complaint web browser so there may be a few markup issues. 

If I validate your page you have a few errors in your markup and it appears that you have only a number of errors in your global CSS document (but the CSS errors don’t seem to major).

———————

And note that I am not a snob about validating sites like a lot of other folk.  I just use it to do a sort of spell check, if you will.

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 29 July 2008 10:39 AM   [ Ignore ]   [ # 16 ]  
Summer Student
Total Posts:  24
Joined  07-12-2008

Yup, I’m coming around to getting better at making sure my CSS and XHTML is compliant, but I just haven’t really spent time doing it with this page.  This is really my first EE run so I’m just playing around for now.

Anyways,

I took the expression out, it looks decent in Firefox and EE, compliance wise, I still have the same number of errors so nothing’s really changed there.  Do you know if plugins have their own CSS settings?

Profile
 
 
Posted: 29 July 2008 11:16 AM   [ Ignore ]   [ # 17 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

Nope, they just limit the text outputted by the enclosed tag.  What code changes when you use the plug-in vs not using the plug-in? Do you see any less/extra markup?

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 29 July 2008 11:21 AM   [ Ignore ]   [ # 18 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2412
Joined  12-06-2002

What’s the formatting set to on the field you’re trying to use Word Limit with?

If it’s XHTML - then you’re probably getting an opening paragraph tag but not the closing tag.

I’ve had to either code the closing tag into the template, or wrap the Word Limit plugin around the HTML Strip plug-in.

 Signature 

Sign up for Southern Fried ExpressionEngine - a 4-day EE class in San Antonio, TX starting on January 20th.

Profile
 
 
   
1 of 2
1
 
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: 64938 Total Logged-in Users: 56
Total Topics: 81910 Total Anonymous Users: 52
Total Replies: 440319 Total Guests: 289
Total Posts: 522229    
Members ( View Memberlist )