0
Good staff!
I have a small problem (problem because I don’t work much with php).
I’m using a script attached to phpbb that displays the topics of a given forum on an external page, but cms returns me only the relative url (the script is in the root of the site and phpbb installed in ./forum), so I can’t create an rss for example, that requires me the absolute url.
The format returned by phpbb is ./forum/viewtopic.php?f=xx&t=xx
What I need is not something so deep in phpbb, but simply a way of translating this relative path into an absolute path, simply removing that first point and adding for example http://exemplo.com
in place, then staying http://exemplo.com/forum/viewtopic.php?f=xx&t=xx
.
How could I do a function to work this using php (maybe a function that uses regex, I don’t know)?
Thank you in advance!
Dude, relative URL never has "." (dots). If it is returned "dot" it is because it is physical path, not URL.
– felipsmartins
Moreover, this depends a lot. You want from a given script (rss.php, for example) to get the absolute URL of the current running script?
– felipsmartins
Not exactly, felipsmartins. The dot character is used to assign a current directory or indentation directory in the case of two dots
../
. It can be used in filesystem or virtual physical path (url). It has nothing to do with identifying whether it is relative or absolute. A relative or absolute path can contain indentations. In short, the right way to say is normalize url or "normalize a path". A subtle but significant difference.– Daniel Omine