CMS Made Simple Forums

cmsms content_en only display specific html tags???
Page 1 of 1

Author:  Sendlingur [ Mon Dec 10, 2018 4:09 pm ]
Post subject:  cmsms content_en only display specific html tags???

I'm not using the wysiwyg editor on my content pages there for my content pages looks like this.

<section class="text-section type2">
         <div class="container animation-top">
            <p>some content text ...</p>

in my search results page I use {page_attr key=content_en} to display the content below the corresponding title.

the problem is that in the search results the {content_en} displays the results like :
page title
{title} some content text ...

Obviously I dont wan't to display the {title} tag, I just need to be able to display what is inside the <p> tags.

Is there a way to let the content_en skip reading the <h2> tags and only read the <p> tags?

Author:  DIGI3 [ Mon Dec 10, 2018 4:33 pm ]
Post subject:  Re: cmsms content_en only display specific html tags???

This is where separating content from markup is a good idea. Move the title and html to your template, and use the content block for content only. Use template inheritance if your pages need different formatting.

If you're not willing to do that, you can use php functions in Smarty. Something like:
{$content={page_attr key=content_en}

You'll probably need permissive Smarty enabled in your config.

Author:  velden [ Fri Dec 14, 2018 12:23 pm ]
Post subject:  Re: cmsms content_en only display specific html tags???

Like DIGI3 says.

If you're new to CMSMS and/or smarty you may not realize you can add multiple content blocks to a page template:

     <h2>{content block=subtitle label='Subtitle' oneline=true}</h2>
     <div class="intro">{content block=intro label='Introduction'}</div>
     <div class="main">{content label='Default content block'}</div>

This is just a vary basic example, you can do much more using e.g. assignment to variables and use it conditionally

{content block=intro label='Introduction' assign=intro}
{if $intro != ''}
  <div class="intro">

and template inheritance etc etc.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group