Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Can't delete posts in forum. (CakePHP) -


i'm using cupcake forum plugin within cakephp. there's form selecting desired posts, , submitting form delete posts. form data apparently being sent 'moderate' function within 'topics' controller using post , methods simultaneously. function first checks see if data sent in post. however, when data received, shows it's get. fellow programmer , don't want change else's internal code, can't figure out how data being sent both methods , being received get. code plugin below:

--------------moderate.ctp (view)---------------------

<?php echo $form->create('post', array('url' => array('controller' => 'topics', 'action' => 'moderate', $topic['topic']['slug']))); ?> 

-------------topics_controller.php (controller)-------

public function moderate($id) {                 if ($this->requesthandler->isget()){    $this->log('is get!');   }    $user_id = $this->auth->user('id');   $topic = $this->topic->gettopicforviewing($id, $user_id, 'id');    // access   $this->toolbar->verifyaccess(array(    'exists' => $topic,     'permission' => $topic['forumcategory']['accessread'],    'moderate' => $topic['topic']['forum_category_id']   ));   $this->log('id: '.$id.'\n');    if ($this->requesthandler->ispost()){    $this->log('is post!');   }   if ($this->requesthandler->isget()){    $this->log('is get!');   }    $this->log($this->requesthandler->getreferer());    $this->log(serialize($this->data));     // processing   if ($this->requesthandler->ispost()) {    $this->log('inside post!');    if (!empty($this->data['post']['items'])) {     $items = $this->data['post']['items'];     $action = $this->data['post']['action'];      foreach ($items $post_id) {      $this->log('action: '.$action.'\n');      $this->log('postid: '.$post_id.'\n');       if (is_numeric($post_id)) {       if ($action == 'delete') {        $this->topic->post->destroy($post_id);        $this->session->setflash(sprintf(__d('forum', 'a total of %d post(s) have been permanently deleted', true), count($items)));       }      }     }    }   } 

we added log checks, show result of 'is get!' in cake's log file. since method get, statement 'if ($this->requesthandler->ispost())' never true; therefore, submitted posts aren't deleted. missing?

try changing moderate.ctp to

<?php  echo $form->create('post', array(     'url' => array(         'controller' => 'topics',          'action' => 'moderate',          $topic['topic']['slug'],      ),     'type' => 'post', ));  ?> 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -