public $variableValue = 'Open';
Why not just do this:
$this->set('variableValue', 'Open');
Jeremy BurnsClass Outfit
http://www.classoutfit.com
Jeremy Burns
http://www.classoutfit.com
On 5 Mar 2013, at 12:08:43, Victor Musvibe <jaahvicky@gmail.com> wrote:
Thank you, now it works. What i did was in my controller i put this line
public $variableValue = 'Open';
Then in my add function
$this->set('variableValue', $this->variableValue);
And lastly in my add view
echo $this->Form->input('status_type', array('type' => 'hidden', 'value'=>$variableValue));
Hope this will help out someone with the same challenge
On Tue, Mar 5, 2013 at 1:08 PM, Jeremy Burns | Class Outfit <jeremyburns@classoutfit.com> wrote:
Correction (sorry):Then in your view you can refer to $myVariableName.Class Outfit
Jeremy Burns
http://www.classoutfit.comOn 5 Mar 2013, at 11:03:15, Jeremy Burns | Class Outfit <jeremyburns@classoutfit.com> wrote: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.Class Outfit
Jeremy Burns
http://www.classoutfit.comOn 5 Mar 2013, at 10:59:50, Victor Musvibe <jaahvicky@gmail.com> 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 <dereuromark@gmail.com> 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 cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
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 cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
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 cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
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 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 cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
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 cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment