I want to add text to some pages.
I made a page and include searchresults with this script:
<?php
$common_baseHREF = "{link saved}";
$common_path = "";
$_GET["q"] = "brand:test";
require($common_path."searchExternal.php");
?>
But it doesn't show the menu options and the sort options.
How can i add these things?
That's working, but I have two questions:
1) When I click on a product, I go to the productpage (test.php?pt=1&product=test1). This productpage show the same text from the previous page. It must show only the productpage.
2) These URL's are not search engine friendly in this external.php script. What do i have to change to make these urls seo friendly?
Hi,
Re: 1, Do you mean the search box etc? I just checked the version of external.php that I sent to you and it should only be the search box that is displayed when $_GET["product"] is set. Perhaps if you could reply to my email with a link to your test page I'll take a look... This can be changed easily if required.
Re: 2, When using external.php, in general another script is in control over the URL; so to implement search engine friendly URLs will require going "under the hood" of the site that you are including external.php within. That's not to say it's not possible - what is required is basically a suitable .htaccess rule that is compatible with your external site to rewrite a friendly style of URL into the required page URL (as in your post). Finally, external.php would then need to be modified to generate that URL in place of the existing version. The rule would be something like this:
RewriteRule ^product/(.*).html$ test.php?pt=1&product=$1&%{QUERY_STRING} [L]
To implement the above, the product link is generated on line 432 of external.php using the following code:
$searchresults["products"][$k]["productHREF"] = $internal_baseHREF."product=".urlencode($product["name"]);
...REPLACE this with:
$searchresults["products"][$k]["productHREF"] = "/product/".urlencode($product["name"]).".html";
Cheers,
David.
Hi David,
I've implemented searchexternal.php and the first 15 results display perfectly. However, the page navigation for the next results doesn't work properly. I see you mentioned a "full" version of the script. Do I need that, or is there something else I'm missing?
Thanks,
Erik
Hello Erik,
Sure - there is a full version of "external.php" available. If you could email me the "calling code" (the PHP that you added to your external page) that you are using that is working with searchExternal.php; i'll email you the full version together with the calling code required for that version...
Cheers,
David.
Hi,
I'll email you the full version of external.php that includes the sort / navigation etc.
Cheers,
David.