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??
$this->message = "Test";in your action, it will be available in your view as$message, but it won't be accessible in your layout unless you use slots, or simply set add the variable to the request using$this->getRequest()->setParameter('message', 'Test');. Either way: it is a workaround solution :)