Summary Template for News

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
User avatar
kerryshamblin
Forum Members
Forum Members
Posts: 87
Joined: Wed Apr 14, 2010 5:21 pm

Re: Summary Template for News

Post by kerryshamblin »

Thanks again for all of the suggestions. I had to take a few days, but now I'm back at it. Psy: I tried to use News instead of news, that didn't make a difference. Applejack: I tried {$entry->fieldsbyname.story} at the inception and again tried it, but it didn't help. I also tried stripping down the News call tag; News displays with just {News}, it seems that the problem is with the summary template, which is currently:

Code: Select all

{strip}
<ul>
{foreach from=$items item='entry'}
{if isset($entry->story)}
<li>
<a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{eval var=$entry->story}</a></li>
{/if}
{/foreach}
</ul> 

{/strip} 
Which is what was working prior to upgrade. The output on the page is only <ul></ul>

I've tried removing/changing little things, but I honestly don't know what I'm doing. It seems that based on the output, that the "story" field definition is not being recognized. Also, do I need the {strip} tags? I was just looking at other templates and trying that out.

Thanks again for your attention.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Summary Template for News

Post by applejack »

Is your custom field story or Story ?

Post the output here of

Code: Select all

{foreach from=$items|@print_r item='entry'}

{/foreach}
My mistake should be {$entry->fieldsbyname.story->value} or {$entry->fieldsbyname.Story->value}
Last edited by applejack on Mon Aug 11, 2014 12:38 pm, edited 1 time in total.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: Summary Template for News

Post by Jo Morg »

kerryshamblin wrote:Which is what was working prior to upgrade.
er... what upgrade? Nowhere in any of your posts you mention an upgrade...
Still, if {$items|print_r:0} doesn't render anything it usually means that the module is not passing any results to the template.
kerryshamblin wrote:Also, do I need the {strip} tags?
no, but, unless it messes up the html or format of the output, it only removes spaces and line breaks, thus compressing the html a bit.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
User avatar
kerryshamblin
Forum Members
Forum Members
Posts: 87
Joined: Wed Apr 14, 2010 5:21 pm

Re: Summary Template for News

Post by kerryshamblin »

Thanks, Jo Morg. I think I had mentioned in one post that this was working prior to upgrading to the latest CMSMS version.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: Summary Template for News

Post by Jo Morg »

applejack wrote:My mistake should be {$entry->fieldsbyname.story->value} or {$entry->fieldsbyname.Story->value}
IIRC the fieldsbyname has been deprecated...

Ok, let's try something else:

Code: Select all

{foreach from=$items item='entry'}
{if isset($entry->fields.story)}
<li>
<a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{eval var=$entry->fields.story->value}</a></li>
{/if}
{/foreach}
HTH

PS: double check the code I had a typo and corrected it.... sorry!
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
User avatar
kerryshamblin
Forum Members
Forum Members
Posts: 87
Joined: Wed Apr 14, 2010 5:21 pm

Re: Summary Template for News

Post by kerryshamblin »

Jo Morg, the code looks fine, to my tired eyes. Still, no display is coming of the news items. The output is still just <ul></ul> so not seeing {if isset($entry->fields.story)}.

I also tried creating a new field def as text field, public, etc and tested with that, but still no luck. Just thinking there may have been a problem with the original field definition.

Current Call Tag: {News detailpage="newsletter-page" summarytemplate="story" sortby="start_time" sortasc="true"}

Current "story" summary template:

Code: Select all

<ul>
{foreach from=$items item='entry'}
{if isset($entry->fields.story)}
<li>
<a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{eval var=$entry->fields.story->value}</a></li>
{/if}
{/foreach}
</ul> 
The News Items that need to be "Stories" have the text field called "story" filled in, and have "Use Expiration Date" set, with the end date being far in the future and the start date being set to create a correctly ordered time list of the stories.

Thanks again.
User avatar
kerryshamblin
Forum Members
Forum Members
Posts: 87
Joined: Wed Apr 14, 2010 5:21 pm

Re: Summary Template for News

Post by kerryshamblin »

Just out of desperation, I went to the DB and checked all of the cms_module_news_fieldvals and removed quote marks, apostrophes and parentheses from the "story" text fields. Cleared cache. Didn't help.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Summary Template for News

Post by applejack »

Re: IIRC the fieldsbyname has been deprecated.

Thanks for letting me know. Since when as I don't have a site running the latest version of CMS using it, latest is 1.11.7.

If that is the case it is pretty stupid and one reason why I'm getting peed off with CMS as there are too many changes with not enough thought given to backward compatibility but that's for a discussion elsewhere.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: Summary Template for News

Post by Jo Morg »

As I said before, you need to troubleshoot this as much as possible... for instance remove or comment out the {if...}{/if}

Code: Select all

<ul>
{foreach from=$items item='entry'}
{$entry|print_r:0}
{*if isset($entry->fields.story)*}
<li>
<a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{eval var=$entry->fields.story->value}</a></li>
{*/if*}
{/foreach}
</ul> 
You need to explore everything possible from a simple default template to the one you want as final. Add up to it or change it bit by bit.
Alternatively try to backup your template and use the default sample template. If a default template, renamed to Test and called like {news summarytemplate='Test' detailpage='newsletter-page'} works then you have a problem with the 'Stories' template almost for sure.
applejack wrote:Re: IIRC the fieldsbyname has been deprecated.

Thanks for letting me know. Since when as I don't have a site running the latest version of CMS using it, latest is 1.11.7.
You are welcome. I can say that it changed in News 2.12 because it is stated so in the default details template comments. :)
applejack wrote:If that is the case it is pretty stupid and one reason why I'm getting peed off with CMS as there are too many changes with not enough thought given to backward compatibility but that's for a discussion elsewhere.
It is indeed a discussion for elsewhere.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Summary Template for News

Post by applejack »

I'm running New 2.12.12 and fieldsbyname still works and nowhere in any of the templates or module help does it mention it.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: Summary Template for News

Post by Jo Morg »

I have this on News 2.14.2 on CMS Made Simple™ 1.11.10 “Pinzon”, and note: deprecated doesn't mean it doesn't work. It is backward compatible until a determined version, assuming that all people read changelogs, docs, and release notes, which more often that not, they don't. That is also why usually only the last two versions of CMSMS and respective Modules are supported at any given time.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Summary Template for News

Post by applejack »

ok thanks for the clarification.
Post Reply

Return to “Modules/Add-Ons”