php - How to render ZF2 form in view in ZF1 project -


I am trying to use ZF2 classes in the ZF2 project. I am following this link: I am an abstractionable I can use ZF2 classes to model models, table models from gateway to make table models.

I am getting an object on the controller. But when I try to render those form objects on the view (PHP), throwing this error, such as:

  Fatal error: call the undefined method in / var / www / myproject / application / modules / tools / views in Zend \ Form \ Form :: openTag () / / script at /scripts/tablesample/add.phtml   

Here is the scene file:

  & lt ;? Use Php Zend \ Form \ form form form; $ BaseUrl = $ this- & gt; Base url (); $ FormObject = new form (); // This form element is $$ form = $ this- & gt; Demo's print block is; $ Form- & gt; Set Attribute ('Action', $ baseUrl.tools / tablesample / add '); $ Form & gt; ready (); Counterfoil $ formObject- & gt; OpenTag ($ form); Echo $ the-> FormRow ($ form- & gt; get ('name')); Echo $ this-> Formo ($ form-> Mill ('Gender')); Echo $ this-> Formo ($ form-> Mill ('hobby')); Echo $ this-> Formaro ($ form-> receive ('email')); Sampling $ this- & gt; FormRow ($ form- & gt; get ('birth')); Counterpart $ the-> formRow ($ form- & gt; receive ('address')); Sampling $ this- & gt; FormRow ($ form- & gt; receive ('direction')); Echo $ the-> Form () - & gt; CloseTag (); ? & Gt;   

I think ZF1 is not detecting ZF2's form assistant or there may be another way of using the ZF2 form assistant in the ZF2 project.

How do I properly pursue this tutorial to create my ZF2 form form:

I need to confirm whether I have a ZF2 form in the ZF2 project Can I use or not? If this can be used, please show me the view file for this tutorial.

While I personally recommend 'integrating ZF2 into ZF1; From the ZF2 side of things, the error you are receiving is due to this line:

$ formObject-> OpenTag ($ form);

You are trying to render the form object Zend \ Form \ Form on the open tag of the form. Instead, pass in the Visual Assistant ( Zend \ Form \ View \ Helpper \ Form ) and then in the form ( $ form )) a logic In form of.

For example

  $ this-> Form () - & gt; OpenTag ($ form);   

You are actually correcting it to close the form (which is not the reason for it):

  per $ echo-> form ( ) - & gt; CloseTag ();   

In addition, I am unsure of your purpose for $ formObject = new form () ; A new form is not required in the code you posted (and you do not really create new examples in this way).

$ this-> Form () Magical __Call () will be caught by the renderer; Who will then see if the service name is form (returning it when received).

All supervised helpers work in this manor. They are such objects that give them the given logic self-reliant and present appropriate HTML

for example $ this-> Form () is used to present form open tags. Another example can be URL Assistant ( $ this-> URL ('route') ) which will generate the URL form of the given arguments.

I will already recommend the source code for the helpers in the scene and will keep a good attitude because this will give you all this good work how they work.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -