Hello Community,
from time to time there are support requests that are related to newsbox() returning nothing. So we might consider to let newsbox() return an appropriate error message if the requested newspage couldn't be found.
However, that might cause existing installations to display these messages, and the user might not be able to fix it for himself.
Another idea is to trigger a PHP notice/warning, when the page doesn't exists, what would be helpful only if the debug mode is enabled.
So I'm not sure, if and how we should improve this issue.
Any ideas?
Christoph
Add error message if newsbox couldn't be found?
Add error message if newsbox couldn't be found?
Christoph M. Becker – Plugins for CMSimple_XH
Re: Add error message if newsbox couldn't be found?
1. For me - as the visitor - it is non of my business, if there is some hidden page to be show in a newsbox. If this for whichever reason doesn't work, I simply don't see it.
2. For me - as the webmaster - it is importnant to see if such page exist, if it is properly defined in a plugin call etc.
So my suggestioin would be to check after login:
If a newsbox is used,
If the call syntax is OK - this could be included in all plugins maybe
if a page used in the call exist.
2. For me - as the webmaster - it is importnant to see if such page exist, if it is properly defined in a plugin call etc.
So my suggestioin would be to check after login:
If a newsbox is used,
If the call syntax is OK - this could be included in all plugins maybe
if a page used in the call exist.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Add error message if newsbox couldn't be found?
Good point!Tata wrote:1. For me - as the visitor - it is non of my business, if there is some hidden page to be show in a newsbox. If this for whichever reason doesn't work, I simply don't see it.
2. For me - as the webmaster - it is importnant to see if such page exist, if it is properly defined in a plugin call etc.
That is a good idea, but it cannot easily be accomplished. Basically, it would be necessary to parse the template for plugin calls and to check their parameters. The latter would require PHP's Reflection API (which is available since PHP 5 only), and even this might not be sufficient (most likely the parameter types can't be verified). However, that is only the tip of the iceberg. What about templates that are dynamically switched? What if there are plugin calls conditionally defined, e.g.Tata wrote:If a newsbox is used,
If the call syntax is OK - this could be included in all plugins maybe
Code: Select all
<?php if (XH_ADM) {echo plugin();}?>
If we'd care only for correct syntax, checking the template shouldn't be much of a problem. Holger has already implemented such a syntax check in http://www.cmsimpleforum.com/viewtopic.php?f=16&t=7730, and I just found php_check_syntax() (available since PHP 5.0.4), which should make that even easier.[1]
This, on the other hand, is already checked in function newsbox(). I suggest that we emit a respective warning, when the user is logged in (i.e. if (XH_ADM)); otherwise we stick to the current behavior (i.e. silently return nothing).Tata wrote:if a page used in the call exist.
PS: [1] I was too quick. The function is available from PHP 5.0.0 to 5.0.4 only, so it is not useful.
Christoph M. Becker – Plugins for CMSimple_XH
Re: Add error message if newsbox couldn't be found?
Of course, this was only an idea, it is really no crucial need.cmb wrote:Tata wrote:If a newsbox is used,
If the call syntax is OK - this could be included in all plugins maybe
Well, here I would preferre the warning in the backend after login:cmb wrote:This, on the other hand, is already checked in function newsbox(). I suggest that we emit a respective warning, when the user is logged in (i.e. if (XH_ADM)); otherwise we stick to the current behavior (i.e. silently return nothing).
1. The page defined in newsboxcall was not found.
2. There is an error while loading the page XY in newsbox, please check the path and/syntax.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Add error message if newsbox couldn't be found?
I would prefer that too, but it would require the static analysis I've mentioned above.Tata wrote:Well, here I would preferre the warning in the backend after login:
1. The page defined in newsboxcall was not found.
2. There is an error while loading the page XY in newsbox, please check the path and/syntax.
Christoph M. Becker – Plugins for CMSimple_XH