In your controller you may want to render a different view than what would conventionally be done.
You can do this by calling render() directly. Once you have called render() CakePHP will not try to re-render the view:
class PagesController extends AppController {
function your_action() {
$this->render('custom_file');
}
}
This would render app/View/Pages/custom_file.ctp instead of app/View/Pages/your_action.ctp
URL Rewriting,example of custom URL rewritting,Paypal sandbox, Select / Unselect all the checkboxes,open cake thtml or ctp file with dreaweaver,generate a paypal token,cakephp
Tuesday, October 4, 2011
Friday, September 2, 2011
Remove controller name from url
In cakephp if you want to remove controller name from URL , just add below line on your's routes.php file.
Router::connect('/:action', array('controller' => 'pages'));
its come something like that locahost/stiename/action .
We do this generally to show our static pages on site without controller name in URL , page which are likes about us ,contact us ,help and so on.
Router::connect('/:action', array('controller' => 'pages'));
its come something like that locahost/stiename/action .
We do this generally to show our static pages on site without controller name in URL , page which are likes about us ,contact us ,help and so on.
Thursday, June 23, 2011
Make PHP to work in HTML files with .htacess
Generally most of web servers across the internet are configured to treat as PHP files only files that end with .php. In case you need to have your HTML files parsed as PHP (e.g .html) or even if you want to take it further and make your PHP files look like ASP, you can do the following:
For web servers using PHP as apache module:
AddType application/x-httpd-php .html .htm
For web servers running PHP as CGI:
AddHandler application/x-httpd-php .html .htm
In case you wish to do the ASP mimick:
For PHP as module:
AddType application/x-httpd-php .asp
OR
For PHP as CGI:
AddHandler application/x-httpd-php .asp
For web servers using PHP as apache module:
AddType application/x-httpd-php .html .htm
For web servers running PHP as CGI:
AddHandler application/x-httpd-php .html .htm
In case you wish to do the ASP mimick:
For PHP as module:
AddType application/x-httpd-php .asp
OR
For PHP as CGI:
AddHandler application/x-httpd-php .asp
Subscribe to:
Posts (Atom)