Kohana URL Confusion -
my bootstrap.php file looks this, , code embed in welcome controller->action_index.
kohana::init(array( 'base_url' => '/kohana/', 'index' => 'index.php' )); okay if put following in in action_index
form::open('test'); the action /kohana/index.php/test.
links appear absolute root install location, accept when embed links in action_index index.php!!!
html::anchor('controller'); the href /kohana/controller not /kohana/index.php/controller.
now if put
url::site('controller'); the returned value /kohana/index.php/controller.
so figured use
html::anchor(url::site('controller')); but href equal http://localhost/kohana/kohana/index.php/controller.
what in world going on, , how fix it?
kohana url system seems unintuitive , wrong.
seems kind of bug in html::anchor implementation.
this happens because of 127th line of html.php (v3.1.2)
$uri = url::site($uri, $protocol, $index); in line $index value false according default anchor function value:
public static function anchor($uri, $title = null, array $attributes = null, $protocol = null, $index = false) so can - pass manually 5th argument true like:
html::anchor('controller', null, null, null, true); or extend kohana_html custom class like:
class html extends kohana_html { public static function anchor($uri, $title = null, array $attributes = null, $protocol = null, $index = true) { return parent::anchor($uri, $title, $attributes, $protocol, $index); } } or fill bug on kohana bugtracker ko devteam decide do.
Comments
Post a Comment