Topic: Search option
Hi This is a rewritten account of the problem of getting Cutenews Search working Cutenews version 2.0.2 I have made copies of my index page as the site is live and I didn't want to update it till I have Search working. I have followed support's suggestion of studying the pinned article about getting Search installed. In addition I have added some code from another user "whis" who had had trouble installing Search.
I still have not resolved the problem. It should be easy. I have added some echo statements to the page where the search results should be displayed. Please refer to the code box at the end of the post.
First using whis's suggestion to put the following code before HTML etc. on the page where the form is:
<?php
require_once("cutenews/core/init.php");
// Play with settings --------------------------------------------------
$pw = REQ('pw');
if ($pw['PHP_SELF']) $PHP_SELF = $pw['PHP_SELF'];
?>
Next the Form code, slightly modified to locate nicely on my website:
<div id="sitesearch">
<!-- SECTION: SEARCH -->
<form action="sitesearch.php" method="GET">
<input type="hidden" name="dosearch" value="Y" >
<div>
<input style="width: 180px; padding: 4px;" class="text" type="text" name="search" value="<?php echo cn_htmlspecialchars(REQ('search')); ?>" >
<input style="width: 75px; padding: 4px;" class="submit" type="submit" value="search" >
</div>
</form>
</div> <!-- site search -->
Finally the code on the page where I want to display the search results:
<td class="centralbox">
<?php
if (isset($_GET['search']) &&$_GET['search'])
{
include ("search.php");
}
else
{
include ("show_news.php");
}
?>
</td>
The Search box displays ok and the page URL on which the search results should be displayed is displayed in the browser window. But no results displayed.
I had to remove Support's code line:
<form action="<?php echo PHP_SELF; ?>" method="GET">
as the page just hung.
The site's on a Linux server. CuteNews 2.0.2 Build ID-202.
<?php
if (isset($_GET['search']) &&$_GET['search'])
{
include ("search.php");
echo "test before else statement, ";
}
else
{
echo "test after else";
include ("show_news.php");
echo "test after show news include";
}
?>
The flow of control through the code doesn't get past the ELSE condition. But it does process the search include, doesn't it?
This is the current situation: Visit My Website