i want to have some classes for separating widgets and normal logic classes, for this i created a base class that other HVMC classes inherit from it, in constructor (before) function of base class i wrote these lines
if ( ! request::is_hmvc())
{
return httpnotfoundexeption
}
btw: i have a widget with a form, the form is created by hmvc pretty well
but when the form is submitted by the user since that post request isn't a hmvc request 404 exception occur in base class.
i try to solve this issue by submit my form to another class that is out of hmvc classes , the result was occurred another problem ,that was instance of the fieldset that i created in hmvc function returned NULL .
btw i stop trying to find better solution for this issue i handle all widgets in normal class now my issue solved
which the diffference that this one does work, and it's one request layer less so it's faster. It also makes is_hmvc() work, in your code ALL requests are HMVC requests due to the additional request in the inline route.
The form loads fine here, and if I request the URI directly, I get a 404.
If I replace your Controller_hmvc before() method with a var_dump(\Request::is_hmvc()), it returns true when I request the root and your form is displayed, and false if I request "/main/hmvc/myform".
ok i think i've had a bad logic that i put the code in before function of controller_hmvc class because i have a widget with a form then so post request has to request the uri directly
Normally you post a form to the same URL, and after processing the form, redirect away, which will prevent users reloading the form in the browser.
If you want to split the logic for displaying the form and processing it in the controller, you can use "get_methodname" and "post_methodname" instead of "action_methodname".
at work i have windows and i've tested it repeatedly and it return me false now i am at home and i have ubuntu i try to test it again and result was amazing it return me fieldset object .
Can't imagine that it has to do with the operating system version.
The variable is created in
$fieldset = \Fieldset::forge('form');
If that fails, the ->add() call on the next line with give you a PHP error (call on a non-object). If you don't have that error, then you have a valid fieldset object. Since it's not a notice, it will not silently continue...