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

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Adding {$entry->content} to search results.
PostPosted: Wed Sep 05, 2018 2:36 pm 
Offline
Forum Members
Forum Members

Joined: Wed Aug 08, 2018 4:59 pm
Posts: 17
Im trying to add {$entry->content} to the search results of my page but with out any luck.


Code:
 <li><a href="{$entry->url}">{$entry->urltxt}</a> ({$entry->weight}%)
     
</li>
{$entry->content}


I know there is a 7 years old post here about the the same issue.
The solution presented in that post doesn't seems to be working with cms 2.x....

Can someone experienced explain to me if it it is possible or not?

thanks in advance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Adding {$entry->content} to search results.
PostPosted: Wed Sep 05, 2018 2:45 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Feb 25, 2009 4:25 am
Posts: 469
Location: Victoria, BC
You could add <pre>{$entry|print_r}</pre> to see what options are available.

If content isn't one of them, you might be able to do something with {page_attr} to obtain the content.

_________________
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: Adding {$entry->content} to search results.
PostPosted: Wed Sep 05, 2018 2:54 pm 
Offline
Forum Members
Forum Members

Joined: Wed Aug 08, 2018 4:59 pm
Posts: 17
I tried <pre>{$entry|print_r}</pre> content is not one of the options.

I'm to much of a newbie to know how to play with the {page_attr} tag :)


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Adding {$entry->content} to search results.
PostPosted: Wed Sep 05, 2018 3:16 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Feb 25, 2009 4:25 am
Posts: 469
Location: Victoria, BC
I just did a bit of testing, and it doesn't look like it's going to be possible to reliably get the page alias from the $entry array.

You could use javascript/ajax to pull in the content from the url, which might actually be nicer anyway as if there's lots of results you could lazy load them as the user scrolls. The url you use in js would be something like {$entry->url}&showtemplate=false

_________________
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: Adding {$entry->content} to search results.
PostPosted: Wed Sep 05, 2018 5:11 pm 
Offline
Forum Members
Forum Members

Joined: Wed Aug 08, 2018 4:59 pm
Posts: 17
I will try the javascript approach, but honestly I think it's a bit strange that the Search Module is so unflexible. Somehow I thought it would be rather easy to just implement $entry -> content to the foreach loop and then the magic would happen :)


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Adding {$entry->content} to search results.
PostPosted: Wed Sep 05, 2018 5:14 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Feb 25, 2009 4:25 am
Posts: 469
Location: Victoria, BC
Agreed, ideally the alias should be returned to make it easier to obtain the content. You can always put in a feature request at http://dev.cmsmadesimple.org/projects/cmsmadesimple

_________________
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: Adding {$entry->content} to search results.
PostPosted: Wed Sep 05, 2018 5:38 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7586
Location: The Netherlands
From default Search result template:
Quote:
{*
You can also instantiate custom behaviour on a module by module basis by looking at
the $entry->module and $entry->modulerecord fields in $entry
ie: {if $entry->module == 'News'}{News action='detail' article_id=$entry->modulerecord detailpage='News'}
*}
This way you can show any News content you want...

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return! [ Click here ]



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Adding {$entry->content} to search results.
PostPosted: Wed Sep 05, 2018 5:40 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7586
Location: The Netherlands
Sendlingur wrote:
Code:
 <li><a href="{$entry->url}">{$entry->urltxt}</a> ({$entry->weight}%)
     
</li>
{$entry->content}

Note:
{$entry->url}, {$entry->urltxt} and {$entry->weight} are Search module Smarty tags
{$entry->content} is from the News module...
You can't mix them here.

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return! [ Click here ]



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Adding {$entry->content} to search results.
PostPosted: Thu Sep 06, 2018 8:43 am 
Offline
Forum Members
Forum Members

Joined: Wed Aug 08, 2018 4:59 pm
Posts: 17
Rolf wrote:
From default Search result template:
Quote:
{*
You can also instantiate custom behaviour on a module by module basis by looking at
the $entry->module and $entry->modulerecord fields in $entry
ie: {if $entry->module == 'News'}{News action='detail' article_id=$entry->modulerecord detailpage='News'}
*}
This way you can show any News content you want...


But what if I want to show the first senteces from a page in content manager? would it work the same way?

And Rolf... I'm using the autocomplete search snippet from your website. It is working like a charm but as you know it is searching through titles and obviously it returns both article titles from the news module and page titles from the content manager.

So my problem is basically to show content text, from any possible module.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Adding {$entry->content} to search results.
PostPosted: Thu Sep 06, 2018 4:22 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7586
Location: The Netherlands
Working example

At https://beeldbank.zeijen.nu I use the Uploads module for photo's.
The important part of the Search Result template is:
Code:
    {foreach from=$results item=entry}
        {if $entry->module == 'Uploads'}
            <div class="grid_2 m_bottom_15">
                {Uploads action='detail' detailtemplate='search' upload_id=$entry->modulerecord}
            </div>
        {/if}
    {/foreach}

I created a detail template in the Uploads module with my needed content:
Code:
<a href="{$entry->canonical}" title="#{$entry->id} - {$entry->summary|escape:'htmlall'|default:''}">
    {CGSmartImage src="{$entry->origfile_url}" class="uploads_summary_img" filter_croptofit="500,500" filter_watermark=true alt="#{$entry->id} - {$entry->summary|escape:'htmlall'|default:''}"}
</a>

As far as I understand your question, this is what you need. This is for Uploads, but it also works for News, CGBlog, LISE, etc.

This link displays the search content: https://beeldbank.zeijen.nu?zoekwoord=rolf
Five times a result, five times displaying an Uploads detail template

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return! [ Click here ]



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Adding {$entry->content} to search results.
PostPosted: Sat Sep 08, 2018 2:09 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3020
Location: The Netherlands
I just checked and it seems IF the 'module' is a content page, neither '$entry->module' nor the '$entry->modulerecord' are provided in the results.

IMO it would make sense to implement this (and probably easy to implement).

Feature request submitted: http://dev.cmsmadesimple.org/feature_request/view/11886


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: googlebot


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:  
A2 Hosting