Page 2 of 2
Re: Summary Template for News
Posted: Mon Aug 11, 2014 12:24 pm
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.
Re: Summary Template for News
Posted: Mon Aug 11, 2014 12:31 pm
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}
Re: Summary Template for News
Posted: Mon Aug 11, 2014 12:37 pm
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.
Re: Summary Template for News
Posted: Mon Aug 11, 2014 12:41 pm
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.
Re: Summary Template for News
Posted: Mon Aug 11, 2014 12:50 pm
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!
Re: Summary Template for News
Posted: Mon Aug 11, 2014 1:13 pm
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.
Re: Summary Template for News
Posted: Mon Aug 11, 2014 1:21 pm
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.
Re: Summary Template for News
Posted: Mon Aug 11, 2014 1:38 pm
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.
Re: Summary Template for News
Posted: Mon Aug 11, 2014 1:47 pm
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.
Re: Summary Template for News
Posted: Mon Aug 11, 2014 1:55 pm
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.
Re: Summary Template for News
Posted: Mon Aug 11, 2014 2:05 pm
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.
Re: Summary Template for News
Posted: Mon Aug 11, 2014 2:32 pm
by applejack
ok thanks for the clarification.