{ID} - 2.4.3.1 Kaitan URL terhadap Penamaan Controller

Sebagaimana Anda lihat, penamaan controller dengan satu kata secara mudah dipetakan ke path URL dalam bentuk lower case. Contohnya, ApplesController (yang mungkin didefinisikan dalam berkas 'apples_controller.php') dapat diakses melalui http://example.com/apples.

Nama controller yang terdiri lebih dari satu kata dipetakan ke URL secara camelCased dengan bentuk plural. Contohnya, RedApplesController (red_apples_controller.php) akan dipetakan ke http://example.com/redApples dan OperatingSystemsController (operating_systems_controller.php) akan dipetakan ke http://example.com/operatingSystems.

{EN} - 2.4.3.1 URL Considerations for Controller Names

As you've just seen, single word controllers map easily to a simple lower case URL path. For example, ApplesController (which would be defined in the file name 'apples_controller.php') is accessed from http://example.com/apples.

Multiple word controllers can be any 'inflected' form which equals the controller name so:

  • /redApples
  • /RedApples
  • /Red_apples
  • /red_apples

will all resolve to the index of the RedApples controller. However, the convention is that your urls are lowercase and underscored, therefore /red_apples/go_pick is the correct form to access the RedApplesController::go_pick action.

Differences

Lines: 1-9Lines: 1-4
-<title>URL Considerations for Controller Names</title>
<p>As you've just seen, single word controllers map easily to a simple lower case URL path. For example, <code>ApplesController</code> (which would be defined in the file name 'apples_controller.php') is accessed from <kbd>http://example.com/apples</kbd>.</p>
<p>Multiple word controllers <em>can</em&gt; be any 'inflected' form which equals the controller name so:</p>r /><ul>&lt;li><kbd>/redApples</kbd> /></li&gt;&lt;li&gt;<kbd>/RedApples&lt;/kbd>r />&lt;/li><li><kbd>/Red_apples&lt;/kbd&gt; />&lt;/li><li><kbd>/red_apples</kbd> /></li>&lt;/ul&gt;r /><p>will all resolve to the index of the RedApples controller. However, the convention is that your urls are lowercase and underscored, therefore &lt;kbd&gt;/red_apples/go_pick</kbd> is the correct form to access the <code&gt;RedApplesController::go_pick</code> action.</p>
+<title>Kaitan URL terhadap Penamaan Controller</title>
<p>Sebagaimana Anda lihat, penamaan controller dengan satu kata secara mudah dipetakan ke path URL dalam bentuk <em>lower case&lt;/em>. Contohnya, <code>ApplesController</code> (yang mungkin didefinisikan dalam berkas 'apples_controller.php') dapat diakses melalui http://example.com/<b>apples</b>.</p>

<p>Nama controller yang terdiri lebih dari satu kata dipetakan ke URL secara <em>camelCased</em> dengan bentuk plural. Contohnya, <code>RedApplesController</code> (red_apples_controller.php) akan dipetakan ke http://example.com/<b>redApples</b> dan <code>OperatingSystemsController</code> (operating_systems_controller.php) akan dipetakan ke http://example.com/<b>operatingSystems</b>.</p>