Page 1 of 1

CTLModuleMaker: specifying a search result page

Posted: Fri Jan 08, 2010 2:08 pm
by Matt Jason H
Hi,

I've created a categorised directory of organisations module using the excellent CTL Module Maker.

On most pages on my site, i have a search box for the module to allow people to search the directory.

However, by default, the module puts the results of the search where the module {tag} is on whatever page the user searched from. This means search results sometimes don't work, go in the wrong place, or look different depending which page you started your search, and usually end up crushed into the side bar of the website.

Is there a way to specify which page or page template should be used to display the results?

If this functionality isn't there, could you give me a clue how I might add it?

I've done custom code in this module to change behaviors, so I'm comfortable adding/editing code, but I'm not sure where to start in making this happen?

Many thanks for any help in advance,
Matt

Re: CTLModuleMaker: specifying a search result page

Posted: Tue Jan 12, 2010 9:20 pm
by plger
From what I understand, the detailpage parameter should do exactly that. Did you try it?
Pierre-Luc

Re: CTLModuleMaker: specifying a search result page

Posted: Wed Jan 13, 2010 9:06 am
by Matt Jason H
plger wrote: From what I understand, the detailpage parameter should do exactly that. Did you try it?
Pierre-Luc
Hi Pierre-Luc,

Thanks for your help.

I've tried that, but it doesn't seem to work for me.

The tag to generate the search form is in my home-page template, and looks like this...
{cms_module module="vcodirectory" what="organisation" action="search" searchmode="simple" detailpage="areas-of-interest"}

The tag on the page of alias areas-of-interest looks like this, and is placed in the {content} tag in a different template...
{cms_module module="vcodirectory" what="interest" detailpage="areas-of-interest"}

All of this looks alright to me, am I missing something that's stopping it working?

Has anyone else got search results from a CTLModuleMaker module to display on a page different to the page the search was performed on?

Matt

Re: CTLModuleMaker: specifying a search result page

Posted: Wed Jan 13, 2010 4:07 pm
by klenkes
Matt, you are right.
I tested on a module made with CTLMM 1.8.8.2 and the detailpage parameter in fact doesn't take me to the specified page, BUT, however, it sets the returnid towards the detailpage and makes the searchlinks going to that page.
The searchresults are displayed in the page where the search started.
Strange...

Bernd

Re: CTLModuleMaker: specifying a search result page

Posted: Wed Jan 13, 2010 4:31 pm
by plger
Looks like a bug.
I don't have this here, but my working version of ctlmm has so much "half-done" modifications that it might be something I fixed in the past few months. Just to help me, could you edit the action.search.php function of your created module, search for:

Code: Select all

$this->CreateFormStart($id, "search",
(it should have only one instance) and tell me if it's followed with $returnid or $linkreturnid
plger

Re: CTLModuleMaker: specifying a search result page

Posted: Wed Jan 13, 2010 4:57 pm
by klenkes
Hi Pierre-Luc.
Looks like:

Code: Select all

	echo $this->CreateFormStart($id, "search", $returnid);

Re: CTLModuleMaker: specifying a search result page

Posted: Wed Jan 13, 2010 6:21 pm
by plger
Then changing $returnid to $linkreturnid should fix it.
(happy new year bernd!)

Re: CTLModuleMaker: specifying a search result page

Posted: Wed Jan 13, 2010 7:19 pm
by klenkes
Happy new year to you too!

I just changed to $linkreturnid but it didn't fix it. Instead the detailpage was the frontpage with a URL like:  http://www.mydomain.de/moduleinterface.php
Maybe it gets fixed in Matts case. I don't use the internal search in one of my projects right now. But later I will.

Speaking of which... how's V.2 going?

Re: CTLModuleMaker: specifying a search result page

Posted: Wed Jan 13, 2010 7:53 pm
by plger
v2.0 isn't going well, in fact I almost had to stop development since mid-december... the core is done, but the creation part isn't, and needless to say the language files and documentation is seriously lacking... but please keep hope, because it'll make a lot of things possible!

Just to make sure, try replacing the $returnid (or $linkreturnid) with this:

Code: Select all

isset($params["detailpage"])?$this->get_pageid($params["detailpage"]):$returnid
in other words :

Code: Select all

	echo $this->CreateFormStart($id, "search", isset($params["detailpage"])?$this->get_pageid($params["detailpage"]):$returnid);
If it doesn't work, send me a copy of your action.search.php.
Pierre-Luc

Re: CTLModuleMaker: specifying a search result page

Posted: Thu Jan 14, 2010 9:30 am
by klenkes
Hey, that's the solution. Works great now.
I put it in my snippet collection for use with the older modules.

And for v 2.0... take your time and do it thoroughly.
If you need someone to test anything... you know where to find me.

Bernd