Search passthru parameter not working
-
gocreative
- Power Poster

- Posts: 265
- Joined: Mon Mar 14, 2011 1:16 am
Search passthru parameter not working
I'm using ListIt2 to show a list of useful links. I'm also using the Search module to search the website, however when clicking on any of the Useful Links in the search results, the item detail is displayed in the Search page template, not the page it's supposed to (a page called Useful Links which has an alias of "useful-links").
Reading the Search module help, I've come across the passthru parameter and I'm calling it as follows, without any luck:
{search resultpage="search" passthru_ListIt2UsefulLinks_detailpage='useful-links'}
No matter what module parameters I pass through, it’s still loading the search results page when it displays the details of any Useful Links items. It is using the correct detail template though (the default).
Am I doing something wrong here?
Reading the Search module help, I've come across the passthru parameter and I'm calling it as follows, without any luck:
{search resultpage="search" passthru_ListIt2UsefulLinks_detailpage='useful-links'}
No matter what module parameters I pass through, it’s still loading the search results page when it displays the details of any Useful Links items. It is using the correct detail template though (the default).
Am I doing something wrong here?
Re: Search passthru parameter not working
Hmmm, I can't get it to work either. Or perhaps I am trying to do something slightly different.
My ListIt2 instance is called "ListIt2GovernorTeam". I use it on a page called "governors".
When a search matches an item in ListIt2GovernorTeam, the search module links to e.g. [root]/governorteam/dawn-smith/75/default and shows the ListIt2 info using the default ListIt2 detail template.
What I actually want the search module to do when it matches an item in ListIt2GovernorTeam is just link to the page called "governors".
I use this to call the search module:
The search module seems to ignore this passthru parameter.
In my ListIt2 instance options I have Module defaults set - both Detail page and Summary page are set to the "governors" page.
Perhaps we're both misunderstanding something?
[steds]
My ListIt2 instance is called "ListIt2GovernorTeam". I use it on a page called "governors".
When a search matches an item in ListIt2GovernorTeam, the search module links to e.g. [root]/governorteam/dawn-smith/75/default and shows the ListIt2 info using the default ListIt2 detail template.
What I actually want the search module to do when it matches an item in ListIt2GovernorTeam is just link to the page called "governors".
I use this to call the search module:
Code: Select all
{search passthru_ListIt2GovernorTeam_detailpage="governors"}In my ListIt2 instance options I have Module defaults set - both Detail page and Summary page are set to the "governors" page.
Perhaps we're both misunderstanding something?
[steds]
Re: Search passthru parameter not working
gocreative, paulbaker,
I think you still need to modify the search results template so it can handle the request properly.
In your template, you'll need to grab results belonging to the module:
For example,
Also, you may need to capture the ListIt2YourInstance template being wanted for search results.
For example, a blog's custom search result page:
One more detail.... In older versions of CMSMS 1.8, 1.9, I had to do regex to change the URL to the article because Search will still try to send it to your default search results page. I don't know if this is the case still.
But, you might need something like
{$articleURL|regex_replace:"/18/":"22"}
Where $articleURL is a var set for the full article link inside of the CGBlog detail template, 18 is the search results page id, and 22 is the desired page id.
I think you still need to modify the search results template so it can handle the request properly.
In your template, you'll need to grab results belonging to the module:
For example,
Code: Select all
{if $entry->module == 'ListIt2YourInstance'}
... then do stuff for it
{/if}For example, a blog's custom search result page:
Code: Select all
{capture assign="results"}{CGBlog action=detail articleid=$entry->modulerecord detailpage="blog-articles" detailtemplate=''search_template''}{/capture}One more detail.... In older versions of CMSMS 1.8, 1.9, I had to do regex to change the URL to the article because Search will still try to send it to your default search results page. I don't know if this is the case still.
But, you might need something like
{$articleURL|regex_replace:"/18/":"22"}
Where $articleURL is a var set for the full article link inside of the CGBlog detail template, 18 is the search results page id, and 22 is the desired page id.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo
--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
-
calguy1000
- Support Guru

- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Search passthru parameter not working
This is not an issue with the search module. but with the Listit2 module (or other module).
Search, when it finds a result for a module, calls the module so that the module can generate the URL, retrieve and format a title etc.
If the module is not using the passed in parameters, then it's the module's fault.
Search, when it finds a result for a module, calls the module so that the module can generate the URL, retrieve and format a title etc.
If the module is not using the passed in parameters, then it's the module's fault.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
-
gocreative
- Power Poster

- Posts: 265
- Joined: Mon Mar 14, 2011 1:16 am
Re: Search passthru parameter not working
Thanks everyone for the input. That being the case, will JohnnyB's workaround do the trick, or is there something else that can be done?
Re: Search passthru parameter not working
Try setting this into the template and see if there is an entry for the Listit2 instance for module or modulerecord
<pre>{$entry|@print_r}</pre>
<pre>{$entry|@print_r}</pre>
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo
--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
-
gocreative
- Power Poster

- Posts: 265
- Joined: Mon Mar 14, 2011 1:16 am
Re: Search passthru parameter not working
Into the search results template, you mean?
Re: Search passthru parameter not working
yep. That way if the module is passing what is needed, as per Calguy, they it should show up with a print_rgocreative wrote:Into the search results template, you mean?
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo
--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
-
gocreative
- Power Poster

- Posts: 265
- Joined: Mon Mar 14, 2011 1:16 am
Re: Search passthru parameter not working
There's this:JohnnyB wrote:Try setting this into the template and see if there is an entry for the Listit2 instance for module or modulerecord
<pre>{$entry|@print_r}</pre>
Code: Select all
[url] => http://mysite.com/item-alias/29
[urltxt] => Item Title
[title] => Module Friendly Name
[intweight] => 3
[module] => ListIt2ModuleName
[modulerecord] => 24
[weight] => 100Re: Search passthru parameter not working
In your case a UseFulLink item actually has a detail view?
Or do you just want the search result link point to the page with all the links.
Or do you just want the search result link point to the page with all the links.
Re: Search passthru parameter not working
Intrigued by this question I've been testing some things.
This seems to work in my test environment.
NOTE: Needs CGSimpleSmarty module!
I started with a more complicated approach to get the ALIAS of the item which is needed for the 'item' parameter of LI2. Although the help explicitly states it must be alias I tested it later with the item ID which seems to work... That makes it a lot easier because item id is already available in the search entry.
This seems to work in my test environment.
NOTE: Needs CGSimpleSmarty module!
Code: Select all
{if $entry->module == 'ListIt2UsefulLinks'}
<li>{$entry->title} - <a href="{module_action_link page='useful-links' urlonly=1 module='ListIt2UsefulLinks' action='detail' item=$entry->modulerecord}
">{$entry->urltxt}</a> ({$entry->weight}%)</li>
{/if}
-
gocreative
- Power Poster

- Posts: 265
- Joined: Mon Mar 14, 2011 1:16 am
Re: Search passthru parameter not working
Thanks velden! I had completely forgotten about {module_action_link}. This code helped solve my problem for a range of modules, so I really appreciate your help on this 
Re: Search passthru parameter not working
The {module_action_link} method works but doesn't give you a pretty URL in the link.
Another option is to create a ListIt2 summary template to use in the site search results, e.g.
And then in your search template:
Another option is to create a ListIt2 summary template to use in the site search results, e.g.
Code: Select all
{foreach from=$items item=item}
<a href="{$item->url}">{$item->title|cms_escape}</a>
{/foreach}
Code: Select all
{if $entry->module == "ListIt2MyInstance"}
<li>{$entry->title} - {ListIt2MyInstance summarytemplate="sitesearch" include_items=$entry->modulerecord} ({$entry->weight}%)</li>
{/if}-
gocreative
- Power Poster

- Posts: 265
- Joined: Mon Mar 14, 2011 1:16 am
Re: Search passthru parameter not working
Nuts? Maybe. Solving problems for ourselves and others? Definitely!

