Hi guys i’ve problems creating a contact form portlet for reusing in all my application pages so my answer is:
This is the right way for reuse contact form in any pages or i wrong?
anyone else do this and can explain me what have done?
the controller is the SiteController that yiic create by default and my ContactForm component is this:
<?php
Yii::import('zii.widgets.CPortlet');
class ContactForm extends CPortlet
{
public $title="Contact Us";
protected function renderContent() {
$form = new ContactForm;
if(isset ($_POST['ContactForm']))
{
$form->attributes=$_POST['ContactForm'];
if($form->validate())
$this->controller->refresh ();
}
$this->render('contactForm', array('form'=>$form));
}
}
the view in the component/views folder is: contactForm.php
<?php echo CHtml::beginForm(); ?>
<div class="row">
<?php echo CHtml::activeLabel($form,'name'); ?>
<br/>
<?php echo CHtml::activeTextField($form,'name') ?>
<?php echo CHtml::error($form,'name'); ?>
</div>
<div class="row">
<?php echo CHtml::submitButton('Submit'); ?>
</div>
<?php echo CHtml::endForm(); ?>
i use in index view this:
<?php $this->widget('ContactForm'); ?>
that’s give me an CException error: ContactForm and its behaviors do not have a method or closure named “getAttributeLabel”.
i don’t undestand cause i’ve done login portlet like in blog tutorial and works but this is not the same?
help me please i’m new in Yii.
TIA