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.

Template Questions /

Why Is Code Appearing In My Article Holder Summaries?


Reply


8 Posts   1316 Views

Avatar
jfusco

Community Member, 52 Posts

6 February 2009 at 3:41am

I'm not exactly sure if this is a new thing or not but some of my article holder pages are showing code in the summaries.
Example: http://wavs.unclebubby.com/actors

Others are perfectly fine: http://wavs.unclebubby.com/comedy-c-d/

It seems that if there is code in that first paragraph, it shows up. My Spidey-Sense tells me it's because the summary field type can't handle HTML. Is there a way to either suppress the code in the summary or let it be interpreted?

Thanks,
Joe

Avatar
UncleCheese

Forum Moderator, 4096 Posts

6 February 2009 at 3:55am

Make sure you cast your Summary field as HTMLText.

Avatar
jfusco

Community Member, 52 Posts

6 February 2009 at 8:04am

Would I need to do that in CSS, PHP or the .ss file?

Avatar
jfusco

Community Member, 52 Posts

10 February 2009 at 10:17am

(bump)

Avatar
UncleCheese

Forum Moderator, 4096 Posts

10 February 2009 at 10:22am

In your ArticleHolder class make sure you have Summary, or whatever the name of the field is, cast as HTMLText.

static $db = array (
'Summary' => 'HTMLText'
);

Avatar
jfusco

Community Member, 52 Posts

10 February 2009 at 11:39am

Edited: 10/02/2009 11:41am

The Articleholder.ss file refers to newsSummary but there is no corresponding reference in Articleholder.php nor Page.php which means it's coming from the core files, right? Since it's not a good idea to edit the core files, how/where should I insert what you suggest?
In Articleholder.php, if I change:

class ArticleHolder extends Page {
static $db = array(
);
static $has_one = array(
);


to

class ArticleHolder extends Page {
static $db = array(
'newsSummary' => 'HTMLText'
);
static $has_one = array(
);


Will that accomplish the desired effect?

Avatar
jfusco

Community Member, 52 Posts

16 February 2009 at 6:04am

(bump)

Still having the problem. Haven't tried anything because I can't figure out where to apply changes. Can someone walk me through it?

Avatar
jfusco

Community Member, 52 Posts

2 March 2009 at 8:53am

Edited: 02/03/2009 8:57am

bump again.

Can someone please tell me where/how, EXACTLY, I need to tell SS the news summary text is HTML? Or if that's not the way to do it tell me how to fix it?

I tried adding 'newsSummary' => 'HTMLText' to the ArticleHolder.php file but that didn't do a darn thing. Looking at ArticleHolder.ss, it directs the page to display $Content.FirstParagraph. Do I need to make some adjustment to $Content... wherever that is stored?

If you want to see an example, check out http://wavs.unclebubby.com/actors/