Is it possible to have specific content on the search pages? So when I get a search result on, say, jumpers it will insert the file I have called jumpers from, say, the "content" folder?
The same for categories.
This is working great, but can I adjust it so that it only shows on the first page of the results and not pages 2,3 etc.?
---------
Jill
Hi Jill,
Sure - you can wrap the entire code that you added within if($page==1), for example:
if ($page==1)
{
$contentFilename = "content/".strtolower($q);
if (file_exists($contentFilename))
{
require($contentFilename);
}
}
Cheers,
David.
Going even one more further with this...
With the above, the search results page no longer shows the order choice.
Is it possible to include(showing 1 to 20 of 10572)
Order by Relevance, Product Rating | Price Low to High, High to Low
??
---------
Jill
Hi Jill,
Sure. If you make a folder on your site using the name suggested: "content", you could add the following code to search.php (towards the end, in amongst the require("html/...") as required:
$contentFilename = "content/".strtolower($q);
if (file_exists($contentFilename))
{
require($contentFilename);
}
If it makes it easier with your editor to have the files named .html or .txt, just add the extension to the $configFilename variable, for example:
$contentFilename = "content/".strtolower($q).".html";
...and then create files in the content folder with a name that exactly match the query (as shown in the text box on the search results page) but in lower case, for example:
content/jumpers.html
content/category:ladies clothing:.html
Cheers,
David.