As we have already learnt that a template is a string or a file that we use to produce some XHTML or XML output depending on our input. Let’s see an example:
Welcome to ::name:: template system and it is ::quality::.
Here we have two template variables - ::name:: and ::quality::. We will assign different values to them.
Now we will save the above simple code into a file named: my_sample.mtt. We will use this file in our haXe code.
class Templ {
static function main() {
var str = haxe.Resource.getString("my_sample");
var t = new haxe.Template(str);
var output = t.execute({ name : "HaXe", quality : “simple and easy”});
trace(output);
}
}
We pass value to our template variable like { name : "HaXe", quality : “simple and easy”}. Now we will compile our code. First we will create an hxml file like the following:
#-swf appTemp.swf
#-neko appTemp.n
#-js appTemp.js
-resource my_sample.mtt@my_first
-main Templ
Here we have included proper command for all the platforms. Just uncomment the specific portion that is useful for a targeted platform.
This will produce an output which will have the template variables replaced by the values that we have passed to it. They will be replaced at runtime. It will show the following output:
Welcome to HaXe template system and it is simple and easy.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
List of my works:
Technical Support:
If you still face the technical problem, please get support of our highly skilled technical team: garazlab.com.
Wordpress Plugins:
If you still face the technical problem, please get support of our highly skilled technical team: garazlab.com.
Wordpress Plugins:
- Real-Time Health Data from Every Where:WP plugin to display real-time health data & increase sale by promoting user specific products according to health information: garazlab.com.
- Woocommerce Stock Notification Builder:Sends desktop, mobile & email notifications with full customization.Build your own product notification system with it: garazlab.com.
Opencart Extensions:
- Product Based Quantity Wise Shipping: Find it here.
- OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
- Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
- Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
- Custom Field Product - add unlimited custom fields to the product form: Find it here.
- Formcaptcha - add captcha on the register page: Find it here.
No comments:
Post a Comment