To pass a variable through to a view, simply do this in your controller
function:
$this->set('myVariableName', $variableValue);
Then in your view you can refer to $variableValue.
Jeremy Burns
Class Outfit
http://www.classoutfit.com
On 5 Mar 2013, at 10:59:50, Victor Musvibe <[email protected]> wrote:
> Hi Euromark
>
> I am the one who posted that. Was hoping to get a quicker response on the
> cakephp group
>
> On Tue, Mar 5, 2013 at 12:57 PM, euromark <[email protected]> wrote:
> http://stackoverflow.com/questions/15221467/how-to-define-a-variable-in-cakephp
>
>
> Am Dienstag, 5. März 2013 11:55:37 UTC+1 schrieb Victor Musvibe:
> I trying to pass a variable in cakephp to a view and getting error Undefined
> variable: view [APP\View\ItQueries\add.ctp, line 9] and line 9 is this
>
> <?php echo $this->Form->hidden('status_type', array('value'=>$view)); ?>
>
> Here is how im defining my variable in the controller
>
> class ItQueriesController extends AppController {
>
> var $view = 'Open';
>
> public function index() {
> $this->ItQuery->recursive = 0;
> $this->set('view', $this->view);
>
> }
>
> //Other Code
>
> }
>
> and here is where im trying to pass the variable as a hidden field
>
> <?php echo $this->Form->create('ItQuery'); ?>
> <?php echo __('Add It Query'); ?></legend>
> <?php
> echo $this->Form->input('status_type', array('type' => 'hidden',
> 'value'=>$view));
> ?>
> <?php echo $this->Form->end(__('Submit')); ?>
>
> Can some please show me how to fix this
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to a topic in the Google
> Groups "CakePHP" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/cake-php/T5fDJXZAHwY/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.