• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: cmsms content_en only display specific html tags???
PostPosted: Mon Dec 10, 2018 4:09 pm 
Offline
Forum Members
Forum Members

Joined: Wed Aug 08, 2018 4:59 pm
Posts: 39
I'm not using the wysiwyg editor on my content pages there for my content pages looks like this.

Code:
<section class="text-section type2">
         <div class="container animation-top">
            <h2>{title}</h2>
            <p>some content text ...</p>
</div>
</section>


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 :
Quote:
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?


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: cmsms content_en only display specific html tags???
PostPosted: Mon Dec 10, 2018 4:33 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Feb 25, 2009 4:25 am
Posts: 781
Location: Victoria, BC
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:
Code:
{$content={page_attr key=content_en}
{strip_tags($content,"<p>")}

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

_________________
Not getting the answer you need? CMSMS support options


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: cmsms content_en only display specific html tags???
PostPosted: Fri Dec 14, 2018 12:23 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3095
Location: The Netherlands
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:

Code:
<__html>
  ...
  </__body>
     <h1>{title}</h1>
     <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>
  <__body>
</__html>


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

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


and template inheritance etc etc.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Hosting Nation - Managed CMSMS Hosting