示例#1
0
<?php

defined('_JEXEC') or die('Restricted access');
$form = new JofeForm('blog', 'post', array('task' => 'index', 'form_title' => 'Post List'));
$base_uri = $this->getComponent()->getURI(array('controller=' . $this->getName(), 'task=show'));
echo $form->start();
echo $form->title(array('create'));
$grid = new JofeGrid(array(array('header' => 'Title', 'width' => '50%', 'field' => 'title', 'callback' => 'post_grid_col_title', 'sortable' => true), array('header' => 'Created', 'width' => '20%', 'field' => 'created_on', 'sortable' => true)), $this->griddata);
$grid->render();
?>

<?php 
echo $form->end();
?>
<script type="text/javascript">
	function post_grid_col_title(row) {
		return '<a href=\"<?php 
echo $base_uri;
?>
&id=' + row.id + '\">' + row.title + '</a>';
	}
</script>
示例#2
0
<br/>
<div class="form-subtitle"><?php 
$post->_count_comment;
?>
 Comments:</div>

<dl class="comments">
	<?php 
foreach ($post->_obj_comment as $comment) {
    ?>
		<dt><?php 
    echo $comment->name;
    ?>
</dt>
		<dd><?php 
    echo $comment->content;
    ?>
</dd>
	<?php 
}
?>
</dl>

<?php 
$form_comment = new JofeForm('blog', 'comment', array('field_wrapper_tag' => 'div', 'field_label_separator' => '</div><div>', 'task' => 'create'));
echo $form_comment->start();
echo $form_comment->hidden('post_id', array('value' => $post->id));
echo $form_comment->text('name');
echo $form_comment->textArea('content');
echo $form_comment->submit('Submit');
echo $form_comment->end();