Grischa Posted September 1, 2014 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 Link to comment Share on other sites More sharing options...
niche Posted September 1, 2014 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 Link to comment Share on other sites More sharing options...
Grischa Posted September 3, 2014 Author 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 Link to comment Share on other sites More sharing options...
niche Posted September 3, 2014 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now