sfBBCodeParserPlugin,部分问题

时间:2011-03-03 11:13:21

标签: php symfony-1.4 partial symfony-plugins

我使用symfony 1.4.8和sfBBCodeParserPlugin 它有效,但我有部分问题。

我的IndexSuccess

include_partial('post/list', array('voice_posts' => $voice_posts)) ?>

在_list.php

 echo $bb_parser->getRawValue()->qparse($voice_post->getDescription());

我有错误

注意:未定义的变量:bb_parser in ...

根据我在action.class中添加的自述文件

 public function executeIndex(sfWebRequest $request)
  {
 ....
 $this->bb_parser = new sfBBCodeParser(); 
  }

在ShowSuccess中,我不使用局部和所有工作正常。 ShowSuccess.php

 echo  $bb_parser->getRawValue()->qparse($voice_post->getDescription()) 

action.class

 public function executeShow(sfWebRequest $request)
  {
 $this->bb_parser = new sfBBCodeParser();
    ...
  }

p.s抱歉我的英文不好

1 个答案:

答案 0 :(得分:1)

您忘记了发送 bb_parser

的部分内容
include_partial('post/list', array('voice_posts' => $voice_posts, 'bb_parser' => $bb_parser)) 

请记住,在定义部分时使用的变量(除非它们是全局的)必须在定义时发送。