Grischa 0 Posted September 1, 2014 Report Share Posted September 1, 2014 How can I use PHP Code for the links.xml file for the Live Search Script (http://www.w3schools.com/php/php_ajax_livesearch.asp). I have thousands of Links, which I want to be searchable. <?phpforeach ($verbs["a"] as $key => $list) {echo '<link>'."n";echo '<title>'.($verbs["a"][$key]).'</title>'."n";echo '<url>a/'.letter($verbs["a"][$key]).'/</url>'."n";echo '</link>'."n";} ?> I want also to know, how to change the script, because I want, that the first letter should be find only words, which starts which this letter and so on. like Search: A Alfred Andy Anna Astrid Search: An Andy Anna Quote Link to post Share on other sites
niche 142 Posted September 1, 2014 Report Share Posted September 1, 2014 You'll have to use an if and and something like substr() http://www.w3schools.com/php/func_string_substr.asp Quote Link to post Share on other sites
Grischa 0 Posted September 3, 2014 Author Report Share Posted September 3, 2014 (edited) You'll have to use an if and and something like substr() http://www.w3schools.com/php/func_string_substr.asp I can't put any PHP Code in the XML file. Can you show me, what you mean exactly? Edited September 3, 2014 by Grischa Quote Link to post Share on other sites
niche 142 Posted September 3, 2014 Report Share Posted September 3, 2014 the short answer is like this: <?php//put your substr() function here?> The longer answer has to do with using an environment that responds to php. I use a localhost based on the download at wampserver.com Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.