Part of the EllisLab Network
pMachine Pro has been replaced by ExpressionEngine, our full featured web publishing solution. Please consider upgrading.
You can download pMachine Pro here: Download pMachine Pro  |  Download Language Packs
   
 
Ellipses
Posted: 18 March 2005 10:47 PM   [ Ignore ]  
Grad Student
Rank
Total Posts:  34
Joined  2004-03-06

Is there a way to remove the extra space that appears before the ellipses (the three dots ...) when excerpts of text are pulled through pMachine Pro? What I get is something like this:

Now is the time ...

But what I want is this:

Now is the time…

Ideas?

Profile
 
 
Posted: 18 March 2005 10:51 PM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9868
Joined  2002-06-19

What pM Tags are you using where you’re getting the excerpted/ellipsised (can you use that as a verb?) text?

 Signature 

Chris Curtis
chriscurtis.org

Profile
 
 
Posted: 19 March 2005 08:38 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  34
Joined  2004-03-06

The one I want to use is this:

<?php weblog_headlines(“all”,“3”,“30”,“personal”); ?>

While it works properly, after the nth word (in this case, the 30th), I get the space and the ellipses.

In pMachine Pro’s “weblog.fns.php” I find the following code driving this:

if (($words != "") && ($words !="all"))
    
{
        $newbody
= "";
        
        
$word = explode(" ",$body);
        
$count = sizeof($word);
        
        if (
$count > $words)
        
{
            
for ($i=0; $i< $words; $i++)
            
{
                $newbody
.= $word[$i] . " ";
            
}                 
            
            $body
= $newbody;
        
}
            
            
if ($words != "")
            
{
                $body
.= "...";
            
}
     }

Any ideas?

Profile
 
 
Posted: 19 March 2005 04:16 PM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9868
Joined  2002-06-19

You could use the trim() function on the $body before adding the ellipsis:

if ($words != "")
            
{
                $body
= trim($body);
                
$body .= "...";
            
}

 Signature 

Chris Curtis
chriscurtis.org

Profile
 
 
Posted: 19 March 2005 04:42 PM   [ Ignore ]   [ # 4 ]  
Grad Student
Rank
Total Posts:  34
Joined  2004-03-06

Thank you! That did it.

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 233, on December 18, 2007 12:04 AM
Total Registered Members: 64509 Total Logged-in Users: 0
Total Topics: 81067 Total Anonymous Users: 0
Total Replies: 436295 Total Guests: 21
Total Posts: 517362    
Members ( View Memberlist )
Active Members: