Topic: Search Option

Hi folks!
Just a quick question on the search option. I did see a 'very' brief post on the subject pinned here but  with far too little information to get it working properly.
Yes i did read the help section and again the information was too limited so im left having to ask for more information.
What code do i need and where do i need to put it in order to get the search function working correctly?
I tried following the help section but to no avail, nothing works at all where the search function is concerned.
any help would be greatly appreciated, thanks

2 (edited by 2015-09-27 06:24:00)

Re: Search Option

ok im back again  http://cutephp.com/forum/style_emoticons/default/cool.gifhttp://cutephp.com/forum/style_emoticons/default/smile.gif
i finally got the search to work! i will provide my code below in a moment to help anyone else having troubles with this search issue,
although the search now works (on mine anyway) there is however still one small issue, it only allows you to search single words or you get a nasty error which i will list also.

working search code ...

    <!-- begin featured content -->
    <div id="featured">
      <h2>News</h2>
      
<?php

                if (isset($_GET['search'])&&$_GET['search'])
                {
                    include ("newsdesk/search.php");
                }
                else
                {
                    $number = "5";
                    include ("newsdesk/show_news.php");
                }
?>    

    </div>
    <!-- end featured content -->

  </div>
  <!-- END content -->
  <!-- BEGIN right sidebar -->
  <div id="rsidebar">
    <!-- begin advertisement -->
    <div class="box">
      <h2>Banner Advertisements</h2>
      <p class="ads"> [url=#][img]images/ad125x125.jpg[/img][/url][url=#][img]images/ad125x125.jpg[/img][/url][url=#][img]images/ad125x125.jpg[/img][/url][url=#][img]images/ad125x125.jpg[/img][/url] </p>
    </div>
    <!-- end advertisement -->
    <!-- begin search box -->
    <div class="box">
      <h2>Search Box</h2>
                <form action="<?php echo PHP_SELF; ?>" method="GET">
                    <input type="hidden" name="dosearch" value="Y" />
                    <div>
                        <input style="width: 200px; 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 it!" />
                    </div>
                </form>
    </div>
    <!-- end search box -->

 

the above is a snippet of my index page of my own website. please note that my main website is in the http://www.mywebaddress.com and my cutenews folder war renamed to newsdesk and the directory is located in http://www.mywebaddress.com/newsdesk.

when i search for something like "test" or "will" or "thanks" it all works fine, news displays and no errors but if i search for "good day" or "is there" or longer phrases like "what is to be" then i get a horrible error, it displays the article and copmments but with the error.

newsdesk/uploads/avatar_ruler_Image1.png" style="width:px;height:50px; margin:0px 5px;"/>Posted on 26 Sep 2015 by ruler
news-fb-comments" data-href="http://www.mywebaddress.com/index.php?id=1443292712" data-send="true" data-layout="standard" data-width="0" data-show-faces="true" data-font="arial" data-colorscheme="light" data-action="like">

anyone else able to search phrases without errors? or is it just me?
when i search it finds everything and when you click on the found objects to view the contents thats when i get the errors. thanks

[EDIT]:
I found the error in search.php, there was a "?" missing before qhl in the line 

$url = cn_url_modify($_static_qr, 'id='.$id, "?qhl=".urlencode($search));

i dont get any errors now but the search results are not highlighted, this is a problem on Apache servers such as mine and needs a work-around to solve this.