Start ::
Developers Corner ::
Module Development ::
pnRedirect failing
Moderated by: Support Team
-
- rank:
-
pnHelper
- registered:
- May 2005
- Status:
- offline
- last visit:
- 23.04.08
- Posts:
- 105
I have run into something really strange. pnRedirect is failing to redirect and instead is giving me a blank white page. Here is some example code that fails in the module.
Redirects will work in other modules, but not in this one. Any ideas? -
- rank:
-
pnProfessional
- registered:
- November 2003
- Status:
- offline
- last visit:
- 09.05.08
- Posts:
- 1530
-
- rank:
-
pnFreshman
- registered:
- January 2006
- Status:
- offline
- last visit:
- 30.03.06
- Posts:
- 18
I had the same problem earlier.. another problem can be that the headers are already sent
Headers will be sent if you for example echo something (http://www.php.net/headers_sent) -
- rank:
-
pnHelper
- registered:
- May 2005
- Status:
- offline
- last visit:
- 23.04.08
- Posts:
- 105
Yep, that is it. Headers are being sent. Thanks Hunkpapa, now I have to figure out what is writing text out. I have some require_once statements in my code, and from reading other posts, that maybe a problem. -
- rank:
-
pnHelper
- registered:
- May 2005
- Status:
- offline
- last visit:
- 23.04.08
- Posts:
- 105
I'm stumped. I completely deleted the file this code was in, pnAdmin.php and added the following as the file
When I try to load the function using the following URL
http://localhost/microtextbook/index.php?module=Exams&type=admin&func=test
I get the message,
headers are already sent.
Any ideas? -
- rank:
-
Steering Committee
- registered:
- December 2002
- Status:
- offline
- last visit:
- 09.05.08
- Posts:
- 13324
Only a few topics down from this one we've already been through all the reasons for pnRedirect failing
http://forums.postnuke.co...file=viewtopic&t=47031
-----
Regards,
Simon
itbegins.co.uk - PostNuke Consulting
Please read the Support Guide -
- rank:
-
pnHelper
- registered:
- May 2005
- Status:
- offline
- last visit:
- 23.04.08
- Posts:
- 105
Hammerhead,
Thanks. I had already seen that thread, but none of the suggestions helped. Anyhow, I was alble to solve the problem by reading up a bit on headers_sent(). It turns out there are two optional parameters that are very useful for tracking down this sort of problem. Here is the code I used
This pointed to my pnTables.php file. I had some extra return characters after the closing ?> at the end of the file. Elimination of these fixed the problem.
Thanks to everyone who helped on this. BTW, Andreas and I are almost finished with a major upgrade of the Exams module. -
- rank:
-
Steering Committee
- registered:
- December 2002
- Status:
- offline
- last visit:
- 09.05.08
- Posts:
- 13324
Glad you found the problem
-----
Regards,
Simon
itbegins.co.uk - PostNuke Consulting
Please read the Support Guide -
- rank:
-
pnProfessional
- registered:
- December 2003
- Status:
- offline
- last visit:
- 08.05.08
- Posts:
- 2635
Whats the deal with the carriage returns... how do they affect the interpreter??
-----
-- David Pahl -- (PostNuke Support Team)
<div id="me" class="none" style="none" />
-
- rank:
-
Steering Committee
- registered:
- December 2002
- Status:
- offline
- last visit:
- 09.05.08
- Posts:
- 13324
Anything outside of PHP tags is treated as HTML source code, and therefore is sent to the browser (even if it is just empty line returns). You can't send headers to the browser if you've already sent it HTML content, so blank lines at the end of files cause the header function to fail.
-----
Regards,
Simon
itbegins.co.uk - PostNuke Consulting
Please read the Support Guide -
- rank:
-
pnProfessional
- registered:
- December 2003
- Status:
- offline
- last visit:
- 08.05.08
- Posts:
- 2635
Really, even though the the file has a .php extension... it defualts to HTML outside the PHP tags... interestng... I did not know that...
/me rethinks problems from the past.
/me learns something today...
/me thought I was just partying with the wife today....
-----
-- David Pahl -- (PostNuke Support Team)
<div id="me" class="none" style="none" />
-
- rank:
-
pnProfessional
- registered:
- December 2003
- Status:
- offline
- last visit:
- 08.05.08
- Posts:
- 2635
...but carriage returns have no purpose outside thetag...??
/me still wonders...
-----
-- David Pahl -- (PostNuke Support Team)
<div id="me" class="none" style="none" />
Start ::
Developers Corner ::
Module Development ::
pnRedirect failing
