Permalink
Browse files

Realizando testes com app e plugin e rotas de app e do plugin

  • Loading branch information...
1 parent 93348e7 commit 99cb940bd069d0d2db53b0f88833b3ab718b7c19 @joaozig committed Apr 9, 2012
View
@@ -122,3 +122,4 @@
* CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit
*
*/
+CakePlugin::load('Blog');
View
@@ -30,6 +30,17 @@
* ...and connect the rest of 'Pages' controller's urls.
*/
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
+ Router::connect('/apresentacao', array('controller' => 'default', 'action' => 'apresentacao'));
+ Router::connect('/contato', array('controller' => 'default', 'action' => 'contato'));
+
+/**
+ * Gambi para as urls dos controllers do plugin funcionar como se fossem controllers da app :D
+ * esse if existe pois evita MissingPluginException caso acesse uma url do plugin (ex.: /blog/teste) sem o mesmo estar carregado.
+ */
+ if(CakePlugin::loaded('Blog')){
+ Router::connect('/blog/:action', array('plugin' => 'Blog', 'controller' => 'blog'));
+ Router::connect('/admin/blog/:action', array('plugin' => 'Blog', 'controller' => 'blog', 'prefix' => 'admin'));
+ }
/**
* Load all plugin routes. See the CakePlugin documentation on
@@ -0,0 +1,12 @@
+<?php
+App::uses('AppController', 'Controller');
+class DefaultController extends AppController {
+
+ public function apresentacao(){
+
+ }
+
+ public function contato(){
+
+ }
+}
@@ -0,0 +1,4 @@
+<?php
+class BlogAppController extends AppController {
+
+}
@@ -0,0 +1,19 @@
+<?php
+class BlogController extends BlogAppController {
+
+ public function index(){
+
+ }
+
+ public function teste(){
+
+ }
+
+ public function admin_teste(){
+
+ }
+
+ public function admin_add(){
+ die('metodo add do plugin Blog');
+ }
+}
@@ -0,0 +1 @@
+<h1>ADMIN de teste - blog ok.</h1>
@@ -0,0 +1 @@
+<h1>BLOG!!</h1>
@@ -0,0 +1 @@
+<h1>Metodo teste ok.</h1>
View
No changes.
@@ -0,0 +1,4 @@
+<h3>Apresentação</h3>
+<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget arcu eget nisl eleifend pellentesque. Phasellus nec est lacus, quis mattis felis. Integer felis purus, consequat eu iaculis vitae, aliquet sed diam. Proin tincidunt purus a ligula semper sit amet pellentesque mauris rutrum. Aliquam erat volutpat. Aenean id eros felis, sit amet pellentesque sem. Mauris non urna arcu, eu mattis nibh. Donec varius lorem eget mi ornare aliquam. In hac habitasse platea dictumst. Nunc ut est at lacus lobortis gravida at at felis. Nullam erat eros, accumsan id consectetur ac, porttitor quis nisi. Curabitur viverra sem in elit facilisis sodales. Nam at ante lacus.</p>
+
+<p>Pellentesque pretium blandit arcu eget ullamcorper. Sed vel nunc id nibh commodo porttitor et non lorem. Maecenas vulputate felis ut nibh scelerisque non malesuada ante vulputate. Nullam sit amet sapien ipsum, non varius urna. Mauris scelerisque laoreet magna, ut condimentum turpis lobortis nec. Fusce condimentum dignissim tortor varius sodales. Mauris sed lacus ac purus bibendum pretium vitae et velit. Praesent venenatis adipiscing lacus, eget faucibus elit feugiat vitae. Donec id sapien sed ante rhoncus sodales sed a felis. Cras tortor nulla, rhoncus quis interdum in, lobortis eu ligula. Nunc vehicula orci ornare velit convallis aliquet a at velit. Fusce massa erat, congue vitae imperdiet id, euismod non libero. In vel fringilla mi. Donec eu quam nibh, in sagittis nisi. Nunc imperdiet auctor elit, sed malesuada augue sollicitudin et. Sed erat ante, fermentum quis ornare vitae, tincidunt sit amet risus.</p>
@@ -0,0 +1,8 @@
+<h2>Contato</h2>
+<form>
+Seu nome: <input type="text" /><br />
+Seu email: <input type="text" /><br />
+Assunto: <input type="text" /><br />
+Texto: <textarea height="50"></textarea><br />
+<input type="button" value="Enviar" />
+</form>
View
No changes.

0 comments on commit 99cb940

Please sign in to comment.