Page 1 of 1

News with cms_selflink not working

Posted: Tue Mar 05, 2019 5:36 pm
by rooon
Hi all,

I'm creating a website www.vencontra.com

Frontend
On the home page you'll find 16 image links using a News Summary template. If you click on the "Axiaal" image, a News Detail template is shown.

Backend:
In the content textarea of this news article I did insert a cms_selflink.

Frontend:
The result of this cms_selflink is

Code: Select all

<a class="button" href="{cms_selflink href='offerte-ventilatoren'}">Offerte aanvragen</a>
When clicking on it the url is http://www.vencontra.com/%7Bcms_selflin ... atoren'%7D

My question
What seems to be the problem that the cms_selflink is not working in the News article content?

Any iedeas?

CMSMS
- CMS 2.2.9.1
- News 2.51.4

Extra modules:
- CGBetterForms 1.9.1
- CGExtensions 1.61.5

Re: News with cms_selflink not working

Posted: Tue Mar 05, 2019 6:00 pm
by DIGI3
If you look at the comments in the sample News templates, you'll see it says that News Detail isn't parsed through Smarty for security reasons. If you are comfortable with the risks (ie, you're not allowing front end submissions), you can use {eval} to parse it, then Smarty tags like cms_selflink will work.

Re: News with cms_selflink not working

Posted: Tue Mar 05, 2019 9:11 pm
by rooon
Hi Digi3,

Thanx for your answer.
A frontend submission form is not used.

In the News Detail template I tried

Code: Select all

{eval var=$entry->content assign="newsContent"}
{$newsContent}

and

{eval var=$entry->content}
Both without success. Also after clearing /tmp/ subfolders no success.
Please give some more hints where to use the {eval}

** this is my Details template

Code: Select all

{strip}
{if isset($entry->canonical)}
  {assign var='canonical' value=$entry->canonical scope=global}
{/if}
{* global var 'newsDetails' for page template *}
{assign var='newsDetails' value=$entry scope=global}
{/strip}
<div id="detailContent">
  {eval var=$entry->content}
</div>
Thanx in advance.

Re: News with cms_selflink not working

Posted: Tue Mar 05, 2019 9:46 pm
by DIGI3
{eval var=$entry->content} worked fine for me. Perhaps you're not editing the correct template? (different design, or detail vs summary)

[SOLVED] News with cms_selflink not working

Posted: Tue Mar 05, 2019 9:56 pm
by rooon
For some reason it does work now with

Code: Select all

{eval var=$entry->content}
Thanx again for your hint.