OpenPNEの一般的な方法

9305 ワード

<?php include_partial('sidemenu',array('form'=>'asdfgasgsad'));?>        '_sidemenu.php'           ,'_sidemenu.php'       $form     



<?php
op_include_box('vote_question_create_box','<strong>asdfasdf</strong>',array('title'=>' ','moreInfo'=>array(' ',link_to(' 2','@my_index'))));
?>
<?php
op_include_box('vote_question_create_box',get_slot('pager'),array('title'=>' ','moreInfo'=>array(' ',link_to(' 2','@my_index'))));
?>
'vote_question_create_box' ,'<strong>asdfasdf</strong>' get_slot('pager') ( slot get_slot() include_slot(),
slot include_slot())
title , 'vote_question_create_box' , 'moreInfo'



<?php slot('pager'); ?> slot
<?php echo 'asdfasgsadfasdfaaaaaaaaaaaaaaaaaaaaaa' ?>
<?php end_slot() ?>
<?php include_slot('pager'); ?> slot , slot




<?php
op_include_form('vote_question_from',$form,array('title'=>' ','url'=>url_for('@vote_update?id='.$form->getObject()->getId()),));
?> ,'vote_question_from' ,$form , title url ,

<?php
public function executeEdit(sfWebRequest $request){
$object = $this->getRoute()->getObject();
// 404
$this->forward404Unless($this->getUser()->getMemberId() == $object->getMemberId());//$object->getMemberId() id member_id
$this->form = new VoteQuestionForm($object);
// http://localhost/openpne/web/vote/edit/1
}
?>



<?php op_include_pager_navigation($pager, '@tasks_list?page=%d'); ?>
$pager $this->pager = Doctrine::getTable('VoteQuestion')->getListPager($request->getParameter('page'));
PluginVoteQuestionTable getListPager() ↓
<?php
class PluginVoteQuestionTable extends Doctrine_Table
{
public function getListPager($page = 1,$size = 20)
{
$query = $this->createQuery()->orderBy('updated_at DESC');
$pager = new sfDoctrinePager('VoteQuestion',$size);//
$pager->setQuery($query);//
$pager->setPage($page);//
$pager->init();
return $pager;
}
}
?>

<?php foreach($pager->getResults() as $item): // openPNE ?>
<dl>
<dt><?php echo op_format_date($item->getUpdatedAt(),'f') //'f' ?></dt><!--op_format_date() 2011-11-10 ‘-’ -->
<dd><?php echo link_to(sprintf("%s(%d)",$item->getTitle(),count($item->getVoteAnswers())),'@vote_show?id='.$item->getId()) ?></dd><!--$item->getTitle() title -->
</dl>
<?php endforeach; ?>





<?php echo link_to('sdsfg','@vote_show?id='.$item->getId()) ?> <a href='vote/show?id=...'>sdsfg</a>









action=" web/ ==== / ==== web "





$this->tasksObject = $this->getRoute()->getObject();
$this->getRoute()->getObject();// id get+ () , $tasksObject-getId();
, vote_question

<?php
class opVotePluginFrontendRouteCollection extends sfRouteCollection
{
public function __construct(array $options)
{
parent::__construct($options);
$this->routes = array(
'vote_edit' => new sfDoctrineRoute(
'/vote/edit/:id',
array('module' => 'vote', 'action' => 'edit'),
array('id' => '\d+', 'sf_method' => array('get')),
array('model' => 'VoteQuestion', 'type' => 'object')
),

);
}
}
?>

getMemberId();?>//現在のログイン者のIDを取得し、ページは$sf_を直接使用できます.userオブジェクト
動作の中でforward404Unless($blood);//ブール型パラメータを取得し、実際に実行しない場合、偽の実行は404エラーページ$request->isMethod('post')にジャンプします.//現在伝わってくる方法がpostかどうかを判断し、真偽$this->setTemplate('partial');executePartial(sfWebRequest$request)メソッドにリダイレクトします.非ジャンプは現在の値を$request->getParameter('i')に転送しません.//指定したキー名から渡された値を取得します.post、getはすべて取得できますか?>Symfonyルーティングはまた、モジュール/動作/後にキー名/値からなるルーティングアドレス、例えばhttp://localhost/openpne/web/my/index/i/6/o/90$request->getParameter('i');$request->getParameter('o');値6と値90をそれぞれ取得