CodeIgniter Forums
Paginate only 1 DB field - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Paginate only 1 DB field (/showthread.php?tid=28058)

Pages: 1 2


Paginate only 1 DB field - El Forum - 03-01-2010

[eluser]Twisted1919[/eluser]
You may want to try a more elegant yet easier solution .
Define a separator for your content , for example wordpress uses <!--more-->
You can do it like that, then add a button to your editor that would insert this separator into the text at the portion you want to cut from .
Then you can do it like :
Code:
if( strpos($content,$separator) !== FALSE )
   {
   explode($separator);
   return $separator[0];
   }
Or you can come up with better code, i don't really know how explode() compares to substr_replace or something similar , i guess is slower .

Not doing like so, and just counting the chars from your text on a fixed limit will get you plenty surprises if your content that needs to be cuted is html(and i am sure it is) .