Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Remove HTHML

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 951 Views
  • Hello_electro
    Avatar
    Community Member
    80 Posts

    Remove HTHML Link to this post

    I have looked at other examples that kond of relate to my problem, but not being as proficient as most, any help would be appreciated. All i want to do is return the first 10 characters of $Content. But I want to do it with NO html included. This way I can style from insode the page.ss. Also, because i am truncating the text, i am getting only an opening html tag which screwing up the code. I have seen a ticket for this but not sure what it means!! I have tried the NoHtml.LimitCharacters(10) suggested in the ticket, but it does not work.

    Thanks in advance. Code below.

    Page.php>>>

    function getGetToKnow() {
    return DataObject::get_one('GetToKnowPage', '', false, 'LastEdited DESC');
    }

    Page.ss>>>>

    <% control GetToKnow %>
          <div>
          <span style="float:left; position:relative;">$Photo.SetWidth(50)</span>
          <h6><a href="$Link">$Title</a></h6>
          $Content.LimitCharacters(10)
          </div>
    <% end_control %>

  • Hello_electro
    Avatar
    Community Member
    80 Posts

    Re: Remove HTHML Link to this post

    bump??

  • theAlien
    Avatar
    Community Member
    131 Posts

    Re: Remove HTHML Link to this post

    I stumbled upon this post:
    http://silverstripe.org/template-questions/show/259050#post259050

    Looks like it's exactly what you're aiming at

    951 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.