Start ::
Developers Corner ::
Module Development ::
PN 0.760 - Cannot Redeclare Head
Moderated by: Support Team
-
- rank:
-
Freshman
- registered:
- May 2003
- Status:
- offline
- last visit:
- 19.11.06
- Posts:
- 36
I thought I got rid of this problem in my Netquery module using the pnHTML() class and $output->Text(Netquery_user_form()); It worked perfectly in PN v0.750. The funtionality still works in PN v0.760-RC1, but I'm now getting the following error at the bottom of the page after the footer -
Absolutely nothing has changed in the Netquery module code and I've double checked every one of its files to ensure that there's NOTHING (not even a CR) after the closing ?>. Any ideas why PN 0.760 would introduce that problem? -
- rank:
-
Moderator
- registered:
- March 2002
- Status:
- offline
- last visit:
- 23.07.08
- Posts:
- 7719
Richard,
Nothing immediately springs to mind. Is the currently released version of Netquery exhibiting these symptoms? If so i'll download it this weekend and take it for spin.
-Mark -
- rank:
-
Freshman
- registered:
- May 2003
- Status:
- offline
- last visit:
- 19.11.06
- Posts:
- 36
Yes the current Netquery release (v2.3) is showing that error, but only when installed under PN 0.760. So it's not seen in the demo on my VIRtech site which is still running PN 0.750.
It would be great if you have time to take a look, Mark. Feel free to email me direct if you have any questions.
-----
Regards,
Richard -
- rank:
-
Moderator
- registered:
- March 2002
- Status:
- offline
- last visit:
- 23.07.08
- Posts:
- 7719
Richard,
Just taken a quick look. The problem comes down to the way in which some of your functions are authored. They're a mix of old style and new style module development standards. IN a pnAPI compliant module you shouldn't be including header.php & footer.php. The module functions should return some output back to the core where it will handle how it's displayed within the theme.
I've put a small fix in cvs to prevent the 'cannot redeclare error'. However you'll still have some text at the bottom of the output has the core expects a return from an API compliant module. The quick fix for this is to return true at the end of your output. This will instruct the core at you've done everything needed in the module (we use this for things like popup windows and the like).
In the longer term i'd suggest maybe taking the output in pnRender and templates. Given that you also write the same module for xaraya you'll find that working with pnRender is very, very similar to working with xaraya - the abstraction of logic (PHP), markup (templates) and presentation (CSS) is very similar between the two systems. Take a look at the example module shipped with .760 for some sample code to work from.
-Mark -
- rank:
-
Freshman
- registered:
- May 2003
- Status:
- offline
- last visit:
- 19.11.06
- Posts:
- 36
Thanks, Mark. Got your "quickfix".
As for the rest of it, I had a premonition that you were going to say something like that.
You're right, of course. I should have started on it with the 0.750 example, but I've gotten away with being lazy until now. I guess, now that the module functionality is pretty well sorted out, it's time to bite the bullet and bring all the API stuff properly up to date.
Thanks again. Much appreciated.
Start ::
Developers Corner ::
Module Development ::
PN 0.760 - Cannot Redeclare Head
