PDA

View Full Version : Config Problem with Search on different pages.


-ding-dong-
08-24-2004, 08:49 AM
Hi,

first of all this is a cool software. I always have searched for it and have found now a good solution for my template generated site.

I installed everything and it works just fine out of the original directory.

But I need the search page in different directories and I like to have the whole phpdig dir outsite the apache htdocs path (for security).

Here is the setup:
DocRoot: c:/apache/htdocs
phpdig Home: c:/apache/search
Search page: c:/apache/htdocs/home/search.php

So I read the thread http://www.phpdig.net/forum/showthread.php?t=839 and configured the following.

$relative_script_path = '../../search';

I deleted the line in config.php and added it in c:/apache/htdocs/home/search.php
$template = "$relative_script_path/templates/searchbox.php";
Then I created the searchbox.php file like in the posting 839.

Now:
If I keep these lines in config.php I run into the exit().
define('ABSOLUTE_SCRIPT_PATH','C:/apache/search');
if ((!isset($relative_script_path)) || (($relative_script_path != ".") &&
($relative_script_path != "..") && ($relative_script_path != ABSOLUTE_SCRIPT_PATH))) {
// echo "\n\nPath not recognized!\n\n";
exit();
}

But if I comment out (just for testing) the block I get the error:
Unable to render template file.

Well I think I don't understand the meaning of the different config settings. What am I doing wrong?

Any help is highly appreciated.

Charter
08-24-2004, 09:13 AM
http://www.phpdig.net/forum/showthread.php?t=1106 ;)

-ding-dong-
08-24-2004, 10:18 AM
Thanks Charter,

found the problem.

My $template var was empty/null in config.php the reason was, that I assigned the value to late.

So, you have to place $template = "$relative_script_path/templates/searchbox.php";
not only before
phpdigSearch($id_connect, $query_string, $option, $refine,
$refine_url, $lim_start, $limite, $browse,
$site, $path, $relative_script_path, $template, $rssdf);


but before any include e.g.
include "$relative_script_path/includes/config.php";
include "$relative_script_path/libs/search_function.php";

So setting it at the beginning of my page solved the problem.

Cheers :-)