umakantp / jsmart

jSmart is Smarty Javascript Template Engine, port of the PHP Smarty Template Engine
MIT License
134 stars 35 forks source link

{master file="sometemplte.tpl"} must read the master file template #18

Closed akshay-since1987 closed 7 years ago

akshay-since1987 commented 7 years ago

This is a requested feature and not a bug or issue with the templating engine.

Can the following be achieved so that the Smarties can be used alongwith Sharpy in .NET as well for master pages as used by Sharpy. Refer documentation at http://sharpy.codeplex.com/ Refer Master page docs at http://sharpy.codeplex.com/wikipage?title=masterpages&referringTitle=Documentation

Regular Page Template:

{master file='Layout.smarty' title="Title"}
<h2>Hello World</h2>

MASTER Page or Layout.smarty:

<!DOCTYPE html>
<html>
<head>
    <title>{$title}</title>
    <meta charset="utf-8" />
</head>
<body>
    {$content}
</body>
</html>

Expected output:

<!DOCTYPE html>
<html>
<head>
    <title>Title</title>
    <meta charset="utf-8" />
</head>
<body>
    <h2>Hello World</h2>
</body>
</html>
umakantp commented 7 years ago

@akshay-since1987 You can always write up a custom plugin and use it in your project.

We would like to keep jSmarty as same as the implementation of Smarty.

Please refer document for creating your own smarty tags:- https://github.com/umakantp/jsmart/wiki/Create-Plugin#function