Hi all. I'm new to cake and I'm trying to make a simple blog with a private adminstrative section for adding posts and some other stuff, and a public one which display post, let visitors add comments, search posts etc.
Well my problem is that I decided to add a static page (about page) in the pages view folder and make its contents editable in the administrative section. So I decided to make an administrative page in which one can set the blog title and edit this about page via two forms. Well both forms are not binded with any model and a call a diffent action but the first form works, i.e. the action get called and data passed to it, while the second one, which contains a textarea to edit the about's content, doesn't, i.e. the action doesn't even get called. Is there any issue having two forms in the same view? Thisi is my code: my_pages_controller.php App::import('Core','PagesController'); class MyPagesController extends PagesController{ function admin_general(){ $this->set("body_id","general_page"); $this->set('about',file_get_contents (VIEWS."pages".DS."about.ctp")); } function admin_blogTitle(){ if(!empty($this->data)) { $conf = file_get_contents(CONFIGS."core.php"); $conf = preg_replace("/\bConfigure::write\(\'BLOG_TITLE\',\'(.*) \'\)/", 'Configure::write(\'BLOG_TITLE\',\''.addslashes($this->data ['formTitolo']['titolo']).'\')',$conf); $file = fopen(CONFIGS."core.php",'w+'); fwrite($file, $conf); fclose($file); } $this->redirect(array ("controller"=>"my_pages","action"=>"admin_general")); } function admin_about(){ if(!empty($this->data)){ $file = fopen(VIEWS."pages".DS."about.ctp","w+"); fwrite($file,$this->data['formAbout']['about']); fclose($file); } $this->redirect(array ("controller"=>"my_pages","action"=>"admin_general")); } } Note: admin_general is the administrataive page admin_general.ctp: <div class="index"> <div id="informazioni"> <div class="intestazione"> <h2>Titolo del blog</h2> <?php echo $form->create(false,array ("action"=>"admin_blogTitle",'id'=>'formTitolo')); ?> <div class="fields"> <div class="input text"> <?php echo $form->text('formTitolo.titolo',array ("value"=>Configure::read('BLOG_TITLE'))); ?> </div> <?php echo $form->submit('Applica'); ?> </div> </div> <div id="editAbout"> <?php echo $form->create(false,array ("controller"=>"my_pages","action"=>"admin_about",'id'=>'formAbout')); echo $form->input('formAbout.about',array ('type'=>'textarea','label'=>'Descrizione del blog', 'rows'=>15,"value"=>$about)); echo $form->submit('Salva modifiche'); ?> </div> </div> </div> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---