-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider grandfather-father-son inheritance. #21
Comments
It should work. There is no limit. As long as you have layout defined it will get used. Let me check it out. |
Yes, your base should have <html lang='zh'>
<head>
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
{* blocks.content *}
{* view *}
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
|
Alternatively you could have these (there are probable a few more ways to do it still, but I think you get the idea): base.html: <html lang='zh'>
<head>
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
{* blocks.content *}
{* blocks.addition *}
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html> home.html: {% layout = "base.html" %}
{-content-}This is Home!{-content-} page.html: {% layout = "home.html" %}
{-addition-}This is addtion..{-addition-} |
So I consider that this is not an issue, but maybe issue of understarding |
Here is another way: base.html: <html lang='zh'>
<head>
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
{* blocks.content *}
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html> home.html: {% layout = "base.html" %}
{-content-}
This is Home!
{* blocks.addition *}
{-content-} page.html: {% layout = "home.html" %}
{-addition-}This is addtion..{-addition-} |
And here is yet another: base.html: <html lang='zh'>
<head>
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
{* view *}
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html> home.html: {% layout = "base.html" %}
This is Home!
{* view *} page.html: {% layout = "home.html" %}
This is addtion.. |
awesome! It does works and in fact more powerful than jinja2. Btw, maybe we should add this post to your readme.md for better explaination of grandfather-father-son inheritance. |
I make a benchmark comparing lua-resty-template's grandfather-father-son inheritance rendering with nginx try_files
lua-resty-temlate
Environment is win10 64. Does this surprise you? |
Test output:
|
@bungle hey dude, have a look at this! |
@Pronan, it feels a bit strange for template+routing to be faster than serving a static file. But I'm not complaining. You have not presented your configs and code, so it is hard for me to judge anything. Have you used But yes, sounds great! 👍 Do you have any other problems with this? If you are willing to send pull-request for better documentation, that would be great! I will at some point revisit the docs, and make it better based on your comments. |
Dude, I can't use google groups now. So let's talk here. the original post is here.
Actually I am using your lua-resty-template. It does support father-son inheritance. But note my example, it's actually grandfather-father-son inheritance which is not supported if I'm not wrong. for example:
base.html
home.html
page.html
test.lua
在 2016年6月14日星期二 UTC+8上午5:17:52,Aapo Talvensaari写道:
The text was updated successfully, but these errors were encountered: