SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jun 2005
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smarty Template Question

    Is it possible with smarty to somehow limit the text displayed? For example say I have something like

    Code:
    <h1>{$headline}</h1>
    <p>{$article}</p>
    and I wanted to restrict the # of characters (and possibly add "..." at the end of it if it was to long), how could I do this?

  2. #2
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Take a look at truncate modifier.
    -- Jelena --

  3. #3
    SitePoint Member
    Join Date
    Jun 2005
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks!

  4. #4
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good Question!

    Is it possible to do this using just PHP?
    For example, if the text displayed is over 45 characters, is it possible to delete the remaining characters, and add "..." to the end?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •