Wednesday, October 17, 2012

Re: how can i route /size to /size.html

+1 on that.

An example:

Move it from app/webroot/size.html to app/View/Pages/size.ctp
Add Router::connect('/size', array('controller'=>'pages', 'action'=>'display', 'size')); to the routes.php
This would of course render this page inside your default layout, which might not be what your are trying to achieve.

A way around that is to add an action to the PagesController:
Move from app/webroot/size.html to app/View/Pages/size.ctp
Add Router::connect('/size', array('controller'=>'pages', 'action'=>'size')); to the routes.php
In your PagesControler create a function:
public function size(){
$this->layout = 'empty';
}
create an empty layout:
//app/View/Layouts/empty.ctp
<?php echo $this->fetch('content'); ?>

(or divide your file into layout + content)

This way you avoid creating a new random controller to, basically, serve a single static page.



On Thursday, October 18, 2012 5:09:28 AM UTC+2, thatsgreat2345 wrote:
You should NOT be doing this. If you want to, then create a controller, and a view then you can use cakephp routes to route the way you want it to.

On Wednesday, October 17, 2012 7:20:55 PM UTC-7, Murray wrote:
I just have a static html file which is app/webroot/size.html. I can access it by the url "/size.html".
But how can i route /size to /size.html?

--
Rui WANG(王瑞)
Murray
School of Electronics Engineering and Computer Science,
Peking University

--
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate