Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

Remove HTHML


Go to End


3 Posts   1588 Views

Avatar
Hello_electro

Community Member, 80 Posts

6 July 2009 at 1:24am

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 %>

Avatar
Hello_electro

Community Member, 80 Posts

8 July 2009 at 10:40am

bump??

Avatar
theAlien

Community Member, 131 Posts

14 July 2009 at 12:12pm

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

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