21310 Posts in 5739 Topics by 2604 members
| Go to End | Next > | |
| Author | Topic: | 1429 Views |
-
*bold* erm?

20 July 2009 at 2:36am
Hi Guys
If I use and article page or blog or anything else if I call it to display on another page, Then the text that is in bold is displayed with asterisk around what is meant to be bold like this *bold* is this a simple css problem, whats the best way to fix it?
Thanks in advance
-
Re: *bold* erm?

20 July 2009 at 3:20am Last edited: 20 July 2009 3:25am
I am looking into the same problem, when I add $Content.LimitWordCount(30)
it removes the strong tag and leaves the asterix's around the text. Removing the limit, and leaving content makes it display correctly.This is the article I can find on variables, all have the same affect.
http://doc.silverstripe.org/doku.php?id=htmltext -
Re: *bold* erm?

20 July 2009 at 3:26am
yep, same problem, has anyone solved this problem? thanks in advance
-
Re: *bold* erm?

20 July 2009 at 9:18pm
FireMe! any further to finding a solution to this problem?
I have been trawling through the forums, and found questions regarding this for both styles and images but I can't find a solution.
why isn't articlepage bringing through any of the styles? or formatting?
-
Re: *bold* erm?

20 July 2009 at 11:29pm
I found these posts regarding the issue, it seems that the html is being stripped out leaving the asterisks:
http://www.silverstripe.org/customising-the-cms/show/255639#post255639
http://www.silverstripe.org/archive/show/248933#post248933
http://www.silverstripe.org/template-questions/show/259050#post259050Sadly these don't seem to answer the problem, anyone have a solution?
-
Re: *bold* erm?

21 July 2009 at 8:48am
Well so far the best I have found is to use:
$Content.Summary(60)
which is removing the asterisks, but also removing all the Html formatting. Does anybody have an answer on how to show a portion of the content without losing the formatting?
-
Re: *bold* erm?

21 July 2009 at 6:12pm
Well, the problem with cutting the html is, that you might cut your content in between opening and closing tags.
Something like:
Lorem ipsum <strong>dolor sit amet, consectetur</strong> adipiscing elit.
Might end up like this:
Lorem ipsum <strong>dolor sit amet
or like this:
Lorem ipsum <strong>dolor sit amet, consectetur</st
which is even worse. You'll end up with invalid html code in either of these scenarios.This is quite a tricky problem, and converting to plain text is by far the easiest solution. If you find a good algorithm to limit the character or word count of html code, without generating invalid html, then you could implement your own text-parser: http://api.silverstripe.com/default/TextParser.html
-
Re: *bold* erm?

21 July 2009 at 8:19pm
I am not sure how I would implement a text parser. Is there any examples?
I have been looking at the blog module, looking at the code could I use something from here to pull a limited text.
How about the following? could it be adapted?/**
* Get a bbcode parsed summary of the blog entry
*/
function ParagraphSummary(){
if(self::$allow_wysiwyg_editing) {
return $this->obj('Content')->FirstParagraph('html');
} else {
$parser = new BBCodeParser($this->Content);
$html = new HTMLText('Content');
$html->setValue($parser->parse());
return $html->FirstParagraph('html');
}
}unfortunately this is just returning the whole text with code.
Is there a simple answer to this, I need to use this a lot in the site I am building.
| 1429 Views | ||
| Go to Top | Next > |


