You have output escaping turned on, so every variable passed to the 
template is escaped.

In symfony escaping is done by decorating every variable in an object.

In your case this object is an instance of sfOutputEscaperArrayDecorator 
which acts as an array.

An instance of this class acts as an array BUT, in PHP, it only works 
under some circonstancies. For example, you are able to use your 
decorated array in a foreach() call. Unfortunately, it does not work 
with the implode() function.

So, you can do something like this:

<?php echo implode(', ', $mkeywords->getRawValue()) ?>

The problem is that you use the unescaped value here.

You can also use foreach(), but it is a bit more complex:

<?php foreach ($mkeywords as $keyword): ?>
   ... do something with $keyword ...
<?php endforeach; ?>

Fabien

Quenten Griffith wrote:
> I have a weird issue that I am sure is something simple I am missing.  I 
> am trying to create a "related tag" page much like the snipeet 
> application uses.  In fact most of the code I am using is from the 
> snipeet application.
> 
> To do this I take all the tags and push them to an array using the 
> explode function, then on the template page I will use the implode 
> function. 
> 
>   public function executeShow()
>   {
>       $this->keyword = $this->getRequestParameter('keyword');
>     $this->mkeywords = explode(' ', $this->getRequestParameter('keyword'));
>      echo is_array($this->mkeywords) ? 'Array' : 'not an Array';
>      
>       //$this->exclude_keywords = explode(' ', 
> $this->getRequestParameter('keyword'));
>     $this->recipes = RecipePeer::getRecipesByKeyword($this->keyword);
>     
> //$this->associated_keywords=RecipeKeywordPeer::getAssiocatedKeywords($this->recipes,
>  
> $this->mkeywords);
>   }
>  
> In the executeShow function, mkeywords is an array, to make sure I was 
> not going insane I added the echo statement just to make sure. Please 
> ignore all the sloppiness I was trying a lot of stuff.
> 
> Now when I get to the ShowSuccess.php template I try to implode 
> $mkeywords and I get an error about implode not being used properly.  So 
> I check using is_array(mkeywords) and it is not an array.  Using 
> is_object(mkeywords) says it is an object.
> 
> How does this go from being an array in the action to an object in the 
> template?
> 
> <?php echo is_object($mkeywords) ? 'Object' : 'not an object';?>
> 
> <br />
> <h3><?php echo "Recipes with keyword ".$keyword?></h3>
> <br />
> <?php echo include_partial('recipe/list', array('recipes' => $recipes))?>
> 
> the print_r output of mkeywords
> 
> ObjectsfOutputEscaperArrayDecorator Object ( [count:private] => 
> [value:protected] => Array ( [0] => christmas ) 
> [escapingMethod:protected] => esc_entities )
> 
> 
> 
> > 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to