Forums / Install & configuration / Writing a new search procedure. Error- View not found in module.

Writing a new search procedure. Error- View not found in module.

Author Message

Stuart Fenton

Thursday 30 January 2003 4:12:37 am

How do I write a new search module.

I did some initial test by overriding the search.tpl file by creating a copy in design/mydesign/content/search.tpl.

This works fine.

So I tried the next step of creating a new search routine. I created a new file called Search_directory.tpl and placed it in the same location. I then copied the search.php routine in the kernel/content/ directory and named it search_directory.php.

But when I access the search routine via the url

mysite/mydesign/content/search_directory/ I get a error message

View not found. The requested view 'search_directory' could not be found in module: 'content'

How do I go about linking this together so I can write the custom routine.

I know I could just use the search.tpl and alter it but I need the normal search left as is.

Any help would be appreciated.

Stuart Fenton

Thursday 30 January 2003 7:26:19 am

> How do I write a new search module.
>
> I did some initial test by overriding the search.tpl file by
> creating a copy in design/mydesign/content/search.tpl.
>
> This works fine.
>
> So I tried the next step of creating a new search routine. I
> created a new file called Search_directory.tpl and placed it
> in the same location. I then copied the search.php routine
> in the kernel/content/ directory and named it
> search_directory.php.
>
> But when I access the search routine via the url
>
> mysite/mydesign/content/search_directory/ I get a error
> message
>
>
> View not found. The requested view 'search_directory' could
> not be found in module: 'content'
>
> How do I go about linking this together so I can write the
> custom routine.
>
>
> I know I could just use the search.tpl and alter it but I
> need the normal search left as is.
>
> Any help would be appreciated.

I have figured out how to add my own search function by adding a new definition to the module.php file:

I added

$ViewList["search_directory"] = array(
"functions" => array( 'read' ),
"script" => "search_directory.php",
"params" => array( ) );

Into the file and it work fine now.

However is this the correct thing to do. Is there a place to put custom changes like this rather than altering the source code?

I hope this helps anyone trying to do the same thing.