Aliasing the Layout Class
#139
taufik-nurrohman
started this conversation in
Ideas
Replies: 1 comment
-
|
With <?= inc::header(); ?>
<?= inc::nav(); ?>
<?= inc::main(); ?>
<?= inc::footer(); ?> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Aliasing is one way to allow users to create more interesting layout API phrases. By default, we use either
self::orstatic::prefix in order to display the layout part. This is because every layout file is basically required directly inside theLayout::get()method itself. Therefore, any layout files will be able to run every static and magic methods generated by theLayoutclass from within its content:Since
selfand/orstaticpoints to theLayoutclass, we can actually use theLayoutphrase as well:Classes in PHP are case insensitive, so we could also use the lower-case version of it:
See manual about
class_alias()in PHP. You can renameLayoutwith something else that is more expressive such asapp,my,the,theme, etc.So that you can replace the layout markup with one of these:
Beta Was this translation helpful? Give feedback.
All reactions