1 (edited by 2015-04-08 09:45:32)

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

Re: Search option

I still need help with this issue.  https://cutephp.com/forum/style_emoticons/default/sad.gif I have updated the post and included a link to the modified Home page so that the Search box can be tested. Using ECHO statements the results of the search do get to the show news include.

Re: Search option

I still need help with this issue.  https://cutephp.com/forum/style_emoticons/default/sad.gif I have updated the post and included a link to the modified Home page so that the Search box can be tested. Using ECHO statements the results of the search do get to the show news include.

I have now resolved this issue. Cutenews wasn't allowing me to use:

include ("cutenews/search.php"); include ("cutenews/show_news.php");

1. It was wrongly stopping the search with a message that I was using the full path. The message suggests if I disagree that I could remove at my own risk: check_direct_including() function. This is in search.php. line 8. I just commented it out.

2. I had to put before the head of my Home page where  the search input box is located:

<?php

require_once("cutenews/core/init.php")
and other lines probably not relevant copied from the Example file;