cakephp

Append Textarea with Cake PHP using Ajax

一曲冷凌霜 提交于 2020-01-06 14:16:21
问题 Quick questions Is there Way to Append a textarea using Cakephp view code: <?php echo $ajax->link( $qnote['Qnote']['subject'], array( 'controller' => 'qnotes', 'action' => 'view', $qnote['Qnote']['id'] ), array( 'update' => 'Textarea_id') ); ?> controller Code: function view($id = null) { $this->Qnote->id = $id; $this->set('qnote', $this->Qnote->read()); } the above code Pulls the information But Replaces the entire Text in the textarea. Is there a way I can just append the textarea with out

Display Image next to HABTM checkboxes

断了今生、忘了曾经 提交于 2020-01-06 13:50:06
问题 Cane Somebody give me an ideas on this Please! I Generate multiple checkboxes from a table that is related with another table with HABTM relationship association. I would like to generate multiple checkboxes with an image along with the text in the label. My two tables are items and items_characteristics. So an Item HasAndBelongToMany characteristics, and an ItemCharacteristic HasAndBelongToMany Items. echo $this->Form->input('Item.ItemCharacteristic',array( 'label' =>false, 'type'=>'select',

Display Image next to HABTM checkboxes

扶醉桌前 提交于 2020-01-06 13:45:30
问题 Cane Somebody give me an ideas on this Please! I Generate multiple checkboxes from a table that is related with another table with HABTM relationship association. I would like to generate multiple checkboxes with an image along with the text in the label. My two tables are items and items_characteristics. So an Item HasAndBelongToMany characteristics, and an ItemCharacteristic HasAndBelongToMany Items. echo $this->Form->input('Item.ItemCharacteristic',array( 'label' =>false, 'type'=>'select',

CakePHP Form Dropdown

我怕爱的太早我们不能终老 提交于 2020-01-06 12:27:18
问题 I've got this table in my database that outputs this: array( (int) 0 => array( 'Price' => array( 'id' => '1', 'amount' => '20', 'price' => '180.00', 'type_id' => '1', 'active' => 'a' ) ), (int) 1 => array( 'Price' => array( 'id' => '2', 'amount' => '30', 'price' => '232.50', 'type_id' => '1', 'active' => 'a' ) ), ...And so on. I need a drop down in my form that displays the amount and price together (ie. "20 @ 180.00"), but when selected, gets the "id" field. I reworked a new array called

CakePHP HABTM question

时间秒杀一切 提交于 2020-01-06 12:22:53
问题 Might be a newbie question as I'm trying to see what all these "PHP frameworks" are at my free time. For starters I want to add multiple tags to multiple photos. I have a tags model and mot model (the photos). Snip of mot model: var $hasAndBelongsToMany = array( 'Tag' => array( 'className' => 'Tag', 'joinTable' => 'mots_tags', 'foreignKey' => 'mot_id', 'associationForeignKey' => 'tag_id', 'unique' => false ) ); In my tags controller in add() I have: $this->Tag->save($this->data); When print_r

Converting named parameters to GET parameters for pagination at CakePHP 2.2

百般思念 提交于 2020-01-06 08:48:13
问题 I am trying to convert named parameters to GET parameters for pagination at CakePHP 2.2 following the instructions given in the documentation but it is not working. Instead of this: http://localhost/cake/posts/yourPosts/page:2?url=posts%2FyourPosts I want this: http://localhost/cake/posts/yourPosts/?page=2&url=posts%2FyourPosts The thing is, when i submit a form using GET method, i don't want to retain the current page, and currently, it is doing it by default because it is not a normal param

Dynamic model relations in CakePHP

徘徊边缘 提交于 2020-01-06 08:37:47
问题 I'm trying to define the relations for a specific Model depending on environment variables. Like this: class Book extends AppModel { public function __construct($id = false, $table = null, $ds = null) { parent::__construct($id, $table, $ds); if (Configure::read('prefix') == 'admin') { $this->hasMany['Page'] = array( // ... 'conditions' => array( /* all pages */ ) ); } else { $this->hasMany['Page'] = array( // ... 'conditions' => array( /* only public pages */ ) ); } } } You could argue that I

Binding through variable declaration in model class doesn't work, but calling a bind function does work

自作多情 提交于 2020-01-06 08:31:49
问题 I have the following model class Comment extends AppModel { var $useTable = "comments"; var $recursive = 1; var $belongsTo = array( 'User' => array( 'className' => 'User', 'foreignKey' => 'userID' ) ); function bindCommentsToUser() { $this->bindModel( array('belongsTo' => array( 'User' => array( 'className' => 'User', 'foreignKey' => 'userID' ) ) ) ); } The belongsTo variable at the top does absolutely nothing, I just cannot get it to work. To confirm that the binding exists, I created the

Binding through variable declaration in model class doesn't work, but calling a bind function does work

十年热恋 提交于 2020-01-06 08:31:01
问题 I have the following model class Comment extends AppModel { var $useTable = "comments"; var $recursive = 1; var $belongsTo = array( 'User' => array( 'className' => 'User', 'foreignKey' => 'userID' ) ); function bindCommentsToUser() { $this->bindModel( array('belongsTo' => array( 'User' => array( 'className' => 'User', 'foreignKey' => 'userID' ) ) ) ); } The belongsTo variable at the top does absolutely nothing, I just cannot get it to work. To confirm that the binding exists, I created the

passing parameters in query function in cakephp

自作多情 提交于 2020-01-06 08:14:19
问题 I'm a beginner in Jquery and I cannot find out the solution to my problem. In cakephp, I have a view where I call my jquery script in the following way: <?php echo $this->Js->click; ?> the jquery function is the following $(function () { $('#toogle-data').hover(function () { $(this).toggleClass('Highlight'); }); $('#toggle-data').click(function () { $("#more").hide(); $(this).toggleClass("active").next().slideToggle("normal"); }); }); This works fine. But when I want to pass parameter, it