Advertisement
christiansalazarh

lanzar un action de inmediato tras ir a un website

Nov 21st, 2012
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. via 1) (ver pastebin) es para cuando quieres que tu URL principal caiga en un action especifico, ejemplo: http://misitioweb.com/
  2.  
  3.   a) edita config/main agregale 'defaultController'=>'otra',
  4.   b) edita OtraController.php agregarle: 'defaultAction'=>'mia',
  5.   eso hara que al visitar tu website automaticamente vaya a index.php?r=otra/mia
  6.  
  7. via 2: (modo callback)
  8.   cuando no quieres alterar a index.php, en cambio quieres que un usuario haga:
  9.   http://misitioweb.com/otro-index.php el cual quieres que haga otro action.
  10.  
  11. <?php
  12. // este archivo pudiera llamarse 'otro-index.php'
  13. //
  14. $yii=dirname(__FILE__).'/../../yii/framework/yii.php';
  15. $config=dirname(__FILE__).'/protected/config/main.php';
  16. defined('YII_DEBUG') or define('YII_DEBUG',false);
  17. defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
  18. $_GET['r'] = '/otra/mia'; // cuando tu usuario abre este archivo lanza este action
  19. require_once($yii);
  20. Yii::createWebApplication($config)->run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement