kayra
-
Posts
3 -
Joined
-
Last visited
Posts posted by kayra
-
-
Hi, thank you for your reply, i'm a newbee and just want to figure out the php code above.
-
Hi, as a newbee i'm trying to figure this code out:
$search = get_the_title(); $lines = file('links.txt'); // Store true when the text is found $found = false; foreach($lines as $line) { if(strpos($line, $search) !== false) { $found = true; echo $line,"<br/>"; } } // If the text was not found, show a message if(!$found) { echo 'not found';
links.txt file contains links like:
<a href="https://blabla.com/blablabla/blablablabla/The word or file to search" target="_blank" rel="noopener noreferrer">The word or file to search</a>
I just want to search the this part: ( ">The word or file to search</a> ) of the url then return it as an clickable url and also limit search results to 3. Could somebody help me which code and where to put in php code above? Thanks in advance.
Searching after last slash
in PHP Coding Help
Posted
Hi Phil, thank you for your reply and help. Does the code you wrote searches after the last "/" (slash)? Because all the urls are different in each line in links.txt file, when i look at the code above i see it searches only one url:
https://blabla.com/blablabla/blablablabla/%s
Is it true?
Best regards.