Is there any kind of command (or script) in PHP equivalent to HTML "redirect"??? I am need to switch execution from one script to another WITHOUT include or require.
On Monday, May 5, 2003, at 02:14 PM, Chris Hayes wrote:
Header("Location: "http://www.site.org/index.php?module=x&func=y&id=15");
Thanks for reply. However, is it possible to do it without Header(...)? The reason I would like to use redirect script (without include, require or header()) is that I have to switch pages and frames, called via Smarty template engine and scattered across large number of directories. include/require just mess up pathnames, and header() is also not appropriate in this case.
I have seen such redirect() script (or function) in moregroupware, but there is enormous number of scripts, it is very hard to find out how they have done it.
include and require do not mess up pathnames, it's just that when you use a relative path, the path they include will depend on which php script you started from. e.g. if path1/file1.php includes path2/file2.php, then if file2.php includes /x/file3.php, they will look insise path1 and not inside path2, as file1.php was the first one. build a complete path to be included to solve this problem. The easiest way i can think of to be sure to get the right path is to chop the current filename off of __FILE__.
Otherwise you can choose from
* javascript solutions. (here again be sure to use the complete url in location.href so netscape works too)
* write a quick page form and include the meta tag you did not lke anyway
* GET urls