PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I've been trying to get wildcard to function when I use the following bit of code. I'm using an external txt file to store all of my page titles to be called in my header file.
The titletags.txt is a text file that simple has this text
search.php|your search results
The part I'm having problems with is having a wildcard after $data[0] so that any of my pages like search.php?keywords=something will register the same as search.php. I've tried lots of combinations trying to insert a wildcard after $data[0] but with no luck. Any suggestions?
for /search.php it would return search.php, however when I used /search.php?keywords=something it would return /search.php?keywords=something, so different method, but i'm still getting the same results. That's not working quite right.
If I can't include a wildcard after my string, can I truncate anything that appears from the . going forward?
I got it now. I used a combination of what I had originally and then used the explode like you suggested to strip out everything after the . in the URL. I had to alter the text file to compensate for the new format, but it works great now.
McRed wrote:I got it now. I used a combination of what I had originally and then used the explode like you suggested to strip out everything after the . in the URL. I had to alter the text file to compensate for the new format, but it works great now.
In my example I was using __FILE__, not the REQUEST URI. You might not be able to use __FILE__ because of how your include structure is setup, I just wanted to make sure you knew that __FILE__ is a PHP magic constant, and not me trying to say to put your file name in there.