私はthis linkに従っています。ZF2でdiv内の入力要素を折り返す方法
ビューでは、私は
echo $this->formRow($product->get('name'));
とソースで、それは
<label>Name of the product<input name="product[name]" required="required" type="text" value=""></label>
のように見せている。しかし、私はこの
<div><label>Name of the product</label></div>
<div><input name="product[name]" required="required" type="text" value=""></div>
ようにしたいを持っています
多分この質問はどこかで尋ねられましたが、私はそれを見つけることができません。
私はphp 5.6
を使用しています。
EDIT:
は答えによると、私はthis linkにこのissue.Followingにドキュメントを解決することができました。私はこの
echo "<div>".$this->formLabel($this->get('categories'))."</div>";
echo "<div>".$this->formInput($this->get('categories'))."</div>";
のように試してみました。この部分
echo $this->formCollection($product->get('categories'));
に問題があるしかし、それは致命的なエラーがスローされます。
Catchable fatal error: Object of class Zend\Form\View\Helper\FormLabel could not be converted to string in /opt/lampp/htdocs/zend2/module/Test/view/test/index/testform.phtml on line 39
どうすればこの問題を解決できますか?
ありがとう、私は 'formLabel'のためのrefを送ることができますか? – Hiranya
@Hiranyaこのリンクを確認してください:https://framework.zend.com/manual/2.1/en/modules/zend.form.view.helpers.html#formlabel –
上記のリファレンスを使用して、私は 'echo $ this-> formCollection($ product-> get( 'categories')); '、しかし、' collection'ではそれをどうやって別にすることができますか? – Hiranya