Welcome Guest, Not a member yet? Register   Sign In
Somewhat confused about URL Helper
#5

In CodeIgniter url's are always Controller / Method

url_to is used for named routes.

PHP Code:
<?php

// The route is defined as:
$routes->get('users/(:num)/gallery/(:num)''Galleries::showUserGallery/$1/$2', ['as' => 'user_gallery']); // the as => is the named route

?>

<!-- Generate the URI to link to user ID 15, gallery 12: -->
<a href="<?= url_to('user_gallery'1512?>">View Gallery</a>  <!-- user_gallery is the named route. -->
<!-- Result: 'http://example.com//users/15/gallery/12' --> 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
Somewhat confused about URL Helper - by joho - 04-06-2023, 01:31 AM
RE: Somewhat confused about URL Helper - by joho - 04-06-2023, 02:56 AM
RE: Somewhat confused about URL Helper - by InsiteFX - 04-06-2023, 10:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB