11
nick89
Re: Truncating text of users news posts
  • 2004/7/18 7:35

  • nick89

  • Just popping in

  • Posts: 47

  • Since: 2004/7/9 8


and does that function ignore formatting when getting a substring?

12
nick89
Re: Truncating text of users news posts
  • 2004/7/18 21:31

  • nick89

  • Just popping in

  • Posts: 47

  • Since: 2004/7/9 8


Quote:

nick89 wrote:
and does that function ignore formatting when getting a substring?

13
Dave_L
Re: Truncating text of users news posts
  • 2004/7/18 21:40

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Take a look at the function, and judge for yourself. It's in include/functions.php. Or try it out.

14
nick89
Re: Truncating text of users news posts
  • 2004/7/24 1:06

  • nick89

  • Just popping in

  • Posts: 47

  • Since: 2004/7/9 8


Here was my solution:
$story = new NewsStory();
    
$story->setTitle($subject);
//EDIT START
    
$story->setBodytext($message);
    
$tc_hack $message;
    
$tc_hack preg_replace('#[(.*?)]#s'''$tc_hack); 
    if(
strlen($tc_hack) < 60){
        
$story->setHometext($tc_hack);
    }else{
        
$story->setHometext(substr($tc_hack,0,30).'...');
    }
//EDIT END
    
$story->setUid($uid);
    
$story->setTopicId($topic_id);
    
$story->setHostname(xoops_getenv('REMOTE_ADDR'));
    
$story->setNohtml($nohtml_db);
    
$nosmiley = isset($nosmiley) ? intval($nosmiley) : 0;
    
$notifypub = isset($notifypub) ? intval($notifypub) : 0;
    
$story->setNosmiley($nosmiley);
    
$story->setNotifyPub($notifypub);
    
$story->setType('user');
    if ( 
$xoopsModuleConfig['autoapprove'] == ) {
        
$approve 1;
        
$story->setApproved($approve);
        
$story->setPublished(time());
        
$story->setExpired(0);
        
$story->setTopicalign('R');
    }
    
$result $story->store();

15
nick89
Re: Truncating text of users news posts
  • 2004/9/9 8:59

  • nick89

  • Just popping in

  • Posts: 47

  • Since: 2004/7/9 8


A working example can be seen at http://www.webmaster-universe.com

Login

Who's Online

129 user(s) are online (113 user(s) are browsing Support Forums)


Members: 0


Guests: 129


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Dec 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits