Topic: search doesn't work

The search function works except for when I click a link in the results. No story shows and the page returns to a blank search page.

Re: search doesn't work

Please help? I really don't understand why search.php doesn't work

Re: search doesn't work

Search works on index.php or the main page where you have the code samples Include where the news, but can be modified in the field

<form method="get" self action="index.php?subaction=search">

Where is the website Do index which shows the results.

Where have the Include code search.php?

Re: search doesn't work

Please describe from which to which page the link shows.

Best regards,
CN Support team

5 (edited by 2013-06-07 12:31:23)

Re: search doesn't work

Please describe from which to which page the link shows.

My site's index page is index.php, I renamed the cutenews' index page to index1.php and included it in index.php. In this file I included also search1.php
I include search.php in file search1.php, when I start search the results are shown, but there is something wrong when I click on the headline which shows the search result the full-story dosen't open. It opens a search form again

Please help

6 (edited by 2013-06-07 21:51:00)

Re: search doesn't work

Woah, what, you're including CuteNews' index.php page in another page?

search.php only shows results but doesn't handle the display of news. If you have a page only with:

<?php include('./cutenews/search.php'); ?>

searching will work, but there is no show_news.php code to display the news.

You have two options:
a) Redirect the search results to be shown with another page, using $PHP_SELF:

<?php
$PHP_SELF = 'news.php';
include('./cutenews/search.php');
?>

The file news.php (referrenced to in $PHP_SELF) being a page including show_news.php

b) Include show_news.php in the same page as search.php:

<div class="search">
 <?php
  include('./cutenews/search.php');
 ?>
</div>

<div class="news">
 <?php
  include('./cutenews/show_news.php');
 ?>
</div>

7 (edited by 2013-06-11 07:37:07)

Re: search doesn't work

doesn't work I really don't understand why i don't make the headlines of search results link to the full news story

8 (edited by 2013-06-11 07:50:40)

Re: search doesn't work

The file search.php cannot show full stories. Only show_news.php can.

When you search with search.php, it will make links for show_news.php, but of course if you only have:

<?php
include('./cutenews/search.php');
?>


There will be no show_news.php anywhere to understand the links that search.php makes.

-----------------------

I see the problem with $PHP_SELF and I apologize for not checking. It looks like $PHP_SELF now says to which page the search request (and not the results) should be sent to. If you have a file just including search.php and would like it to show the results & full story to another page (let's name it full.php), something like this would work:

searchbox.php

<?php
$PHP_SELF = 'full.php';
include('./cutenews/search.php');
?>

full.php

<?php
if(isset($_GET['dosearch'])){
  include('./cutenews/search.php');
}
else{
  include('./cutenews/show_news.php');
}
?>

-----------------------

It is possible to show the results on the same page but to have the links go to another page. This will need some editing in a TPL file, and I'm a little lazy right now, so just shout if you want to do that and I'll tell you what to do (if no one beats me to it).

-----------------------

It's also possible to have search.php and show_news.php on the same page. This would be the best way if you want to show active news (or whatever) and have a search sidebar somewhere. The results would then be shown in the same page.
This is how CuteNews' example2.php works.


For future reference — "it doesn't work" isn't very helpful feedback. If something is wrong, please explain what you did and how it is not working to your wishes. That way, we can address your problems a lot better. Thanks!