Page 1 of 1

Tag search and CGBlog

Posted: Sun Dec 08, 2019 12:19 pm
by Gregor
Based on the description in this topic viewtopic.php?f=4&t=80640 I modified the 'Search Results template' to:

Code: Select all

<h3>{$searchresultsfor} "{$phrase}"</h3>
{if $itemcount > 0}
<ul>
  {foreach from=$results item=entry}
  <li>{$entry->title} - <a href="{$entry->url}">{$entry->urltxt}</a> ({$entry->weight}%)</li>
    {if $entry->module == 'CGBlog'}
        {CGBlog action="default" summarytemplate='blogSummary_LeftRight' articleid=$entry->modulerecord detailpage='logboek'}
    {/if}
  {/foreach}
</ul>

<p>{$timetaken}: {$timetook}</p>
{else}
  <p><strong>{$noresultsfound}</strong></p>
{/if}
The code above stops with a fatal error after 30seconds. Is the snippet above the way to use the CGBlog summary template to show the to the search related records, or do I have to mix the code from the summary template into the search results template?

Re: Tag search and CGBlog

Posted: Fri Dec 13, 2019 10:20 am
by Gregor
gentle kick...

Re: Tag search and CGBlog

Posted: Fri Dec 13, 2019 10:57 am
by velden
Although I doubt it will cause the fatal error it seems a little strange to call CGBlog's default action (which usually is a summary action) and supplying an articleid parameter.

I'd expect it should be the 'detail' action and detail template.

Re: Tag search and CGBlog

Posted: Sat Dec 14, 2019 6:27 am
by Gregor
Thanks Velden.

These parameters seems to be in conflict with each other.

Basically what I what to achieve is show the summary template for each cgbolg article record that matches the search. {CGBlog action="default" summarytemplate='blogSummary_LeftRight'} will probably perform action on all cgblog records.

Any suggestions on how to only show the searched records in the summarytemplate view?

Re: Tag search and CGBlog

Posted: Sat Dec 14, 2019 3:00 pm
by velden
I quickly scanned CGBlog help and didn't find a way to provide multiple article ids to this module.

I guess you will have to create a detail template to mimic the behavior of the summary template (though this can be a challenge because the detail template isn't usually used to start and end a series of items (opening and closing a div for example) and it also will be harder to implement a left/right solution (the template name makes me think your doing something like that).

Pagination will also be a problem.

Re: Tag search and CGBlog

Posted: Mon Dec 16, 2019 7:14 am
by Gregor
You're right on the left / right lay-out.

I think the solution would be to collect the multiple id's based on the search and feed these to the cgblog summary template. Easier said than done....