Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
taufik-nurrohman committed May 9, 2020
1 parent 2fda61e commit 712d93a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions route/about.page
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Route
description: Custom route tool.
description: Custom route files.
author: Taufik Nurrohman
type: Markdown
version: 1.0.0
Expand All @@ -17,14 +17,14 @@ Add some PHP files in `.\lot\route` folder:
└── contact.php
~~~

Those route files will automatically take effect on the existing site with an address according to the location of the route file, excluding the `.php` extension. For example, in the file structure above, two routes will be applied:
Route files will automatically take effect on the existing site with an address according to the location of the route file, excluding the `.php` extension. For example, based on the file structure above, two routes will be applied:

~~~ .txt
http://127.0.0.1/route/contact
http://127.0.0.1/route/user/register
~~~

Two global variables called `$id` and `$path` are available for use within the route file. `$id` refers to the value after the `http://127.0.0.1/route/` path, and `$path` refers to the route’s file path.
Two global variables with name `$id` and `$path` are available to be used within the route file. `$id` refers to the value after the `http://127.0.0.1/route/` path, and `$path` refers to the route’s file path.

The following is an example contents of a route file:

Expand Down Expand Up @@ -63,7 +63,7 @@ if (send($from, $to, $title, $content)) {
Guard::kick('contact');
~~~

And therefore you will be able to use that route as the form action in the HTML form element like this:
Therefore you will be able to use that route as the form action in the HTML form element like so:

~~~ .html
<form action="<?= $url; ?>/route/contact" method="post">
Expand Down
1 change: 0 additions & 1 deletion route/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

function route($id) {
if (\is_file($path = \LOT . \DS . 'route' . \DS . \strtr($id, '/', \DS) . '.php')) {
$GLOBALS['token'] = \Guard::token('route');
extract($GLOBALS, \EXTR_SKIP);
require $path;
}
Expand Down

0 comments on commit 712d93a

Please sign in to comment.