sfBBCodeParserPlugin, problems with partial

60 Views Asked by At

I use symfony 1.4.8 , and sfBBCodeParserPlugin It works , but I have problem with partial.

My IndexSuccess

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

In _list.php

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

And I have error

Notice: Undefined variable: bb_parser in...

according to the readme I added in action.class

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

In ShowSuccess I do not use partial and all work fine. ShowSuccess.php

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

action.class

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

p.s Sorry for my bad English

1

There are 1 best solutions below

0
On BEST ANSWER

You forget you send to the partial the bb_parser:

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

Remember that the variables used in partials (unless they're global) must be sent when you're defining it.