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
-
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 theLayout
class from within its content:Since
self
and/orstatic
points to theLayout
class, we can actually use theLayout
phrase 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 renameLayout
with 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