Results 1 to 9 of 9

Thread: display keywords searched in public page

  1. #1
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,732

    Default display keywords searched in public page

    This hack will allow you to display list of keywords searched in public page. But no in header and footer. Most of you may put it in index.html.

    Installation: just copy the file to your indexu folder, rename it to.php

    Usage: Edit your desire template file to put list of keywords
    Code:
    // usage: <php>include("search_log.php?a=$action&max=$row");</php>
    // where - $action can be "last" --> display last keywords searched 
    //                        "top" --> most popular keywords searched
    //       - $max is the number of rows
    // example: <php>include("search_log.php?a=last&max=10");</php>
    //
    // or if you have problem with include directory error message,
    // use http include
    //          <php>include("http://domain.com/search_log.php?a=last&max=10");</php>
    Attached Files Attached Files

  2. #2
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    it does produce a list but at the top of the list I get
    Code:
    Warning: Unknown(): stream does not support seeking in /home/acct5/public_html/reviews/lib/template.lib.php(88) : eval()'d code on line 1
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  3. #3
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default Re: display keywords searched in public page

    with a little tinkering and modification to the code, you can add it to the header/footers....
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  4. #4
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,732

    Default

    Where you put the code? I didn't get any error msg. I tried in index.html.

    Btw, do you have any idea how it can work in header/footer?

  5. #5
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    I just followed your instructions. I'm good at that! Still gave me the error.

    to put it in the headers/footers do the following :

    add the following to misc.php ( to create the misc.php file see http://www.nicecoder.com/community/s...&threadid=1291 )

    Code:
    // mod popular searches
        $query = "select distinct keyword, count(keyword) as ck from idx_searchlog 
          group by keyword order by ck desc";
        $result = $conn->Execute($query);
        $total = $result->RecordCount();
        $number=$i=0;;
        while($i<10 && $i<$total) {
          $number=$i+1;
          $result->Move($i);
          $keyword = $result->Fields("keyword");        
          $count = $result->Fields("ck");      
          $top_keywords .= "<br>$number. $keyword";  
          $i++;
        }
    Change 10 to whatever number you want

    make the following change in ALL of the php files (add.php, modify.php, etc ) including the ones in cp ( if your editor does a replace over multiple files, it is real quick ):
    Code:
    // mod for misc - online, hot, stats, keywords
     include("misc.php");
    DisplayTemplate($theme_path."header.html","\$title,\$cat");
    if you want it in the header
    Code:
    // mod for misc - online, hot, stats, keywords
    include("misc.php");
    DisplayTemplate($theme_path."header.html","\$title,\$cat ,\$top_keywords");
    if you want it in the footer
    Code:
    // mod for misc - online, hot, stats, keywords
    DisplayTemplate($theme_path."footer.html","\$cat ,\$top_keywords");
    then add <%top_keywords%> to either the header.html or footer.html as appropriate ( don't forget the header.html/footer.html in themes/default/cp )

    I think that will do it.

    It runs on mine...!
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  6. #6
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,732

    Default

    Still got an error?
    PHP Code:
    <php>include("http://domain.com/search_log.php?a=last&max=10");</php
    Do not forget ; at the end of include()

  7. #7
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    yep, I still get the error. and the ; is there. I just copied and pasted.

    No biggie unless other folks are getting an error msg too.

    I must have something messed up...!
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  8. #8
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,732

    Default

    does include() point to the right file location?

  9. #9
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Originally posted by dody
    does include() point to the right file location?
    yes.

    see above post
    it does produce a list but at the top of the list I get [an error msg]
    I probably just have something messed in my files...it will show up sooner or later
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

Similar Threads

  1. what does it mean ?
    By lewisw in forum v5.x
    Replies: 10
    Last Post: 08-29-2003, 02:05 AM
  2. Replies: 4
    Last Post: 08-19-2003, 04:10 PM
  3. Replies: 1
    Last Post: 08-19-2003, 08:40 AM
  4. Replies: 3
    Last Post: 08-14-2003, 10:11 AM
  5. Problems with page display
    By tsmedstad in forum v5.x
    Replies: 4
    Last Post: 07-05-2002, 03:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •