3 Votes Vote

Symfony variable passing from action to view

Posted by topdog 523 days ago Questions| view action symfony All

Hello I have the following proble:

I have the action class of a view in Symfony, action.class.php, in there i have this code:

foreach ($images as $i => $img)
 {
   if (strstr($request->getFileType($img), 'image'))
   {
     $enter = true; 
     $name = Util::processImages($request, $img, 'app_uploads_temp_dir');

     if ($name != '')
     {
        $userimages[$i] = $name;
        $this->uploads[$i] = true;
        $this->message = 'Image loaded';
     }
   }
}

And in my view I want to render an upload field or a message depending on the case:

<div class="fotoupload">
   <?php if ( !isset($this->uploads[1]) ): ?>
   <?php echo label_for('photosec1', 'Imagen 2:') ?>
   <?php echo input_file_tag('photosec1') ?>
   <?php else: ?>
   <span><?php $this->message ?></span>
   <?php endif ?>
</div>

but $this->message is not set, neither is $message or any variable passed from the action, can someone tell me why this happen and how could I solve it??

Originally asked by: dconde on Stack Overflow

Discuss Bury


Who Voted for this Question