File: examples/hello-name.html

Recommend this page to a friend!
  Classes of Diego La Monica  >  Xtemplate  >  examples/hello-name.html  >  Download  
File: examples/hello-name.html
Role: Example script
Content type: text/plain
Description: Example
Class: Xtemplate
Template engine that uses HTML page fragments
Author: By
Last change: V 1.4.1
- Updated examples
Date: 6 years ago
Size: 5,616 bytes


Class file image Download
<!DOCTYPE html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Hello (with my) name</title>
    <script type="text/javascript" src="//"></script>
    <script src="//"></script>
    <script type="text/javascript" src="../xtemplate.js"></script>
    <script src=""></script>

    <link rel="stylesheet" href="">
        div#example {
            border-radius: 10px;
            border: 2px dashed #ddd;
            margin: 1em;
            padding: 1em;

    <script type="text/x-template" id="hello-name-template">
        <div class="row">
            Hello {$name}!
    <div class="container">

        <nav class="navbar navbar-default" role="navigation">
            <div class="container-fluid">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-navbar-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    <a class="navbar-brand" href="./">XTemplate</a>
                <p class="navbar-text">Basic example with a single variable</p>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="bs-navbar-collapse">

                    <ul class="nav navbar-nav navbar-right">
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Similar examples <b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li><a href="hello-world.html">Basic example</a></li>

                </div><!-- /.navbar-collapse -->
            </div><!-- /.container-fluid -->

        <div class="row" id="example">
            <div class="col-md-12" id="my-section">
                This text will be replaced

        <div class="row">
            <div class="well well-lg">

                <h1>Did you enjoyed this example?</h1>
                    Producing this library and an example like this, bring me a lot of time away from me, so I need to
                    know how much this library is of community interest to program its evolutions, updates and upgrades.
                    Then I'm asking you to perform 3 simple things to demonstrate your interest:
                    <li><a target="_blank" href="">Star</a> (and watch) this library on GitHub</li>
                    <li><a target="_blank" href="">Follow me</a> on Twitter</li>
                    <li>Add a like to <a target="_blank" href="">my Facebook page</a></li>


        <!-- Source code viewer -->
        <ul class="nav nav-tabs">
            <li class="active"><a href="#js-code" data-toggle="tab">Javascript</a></li>
            <li><a href="#xt-code" data-toggle="tab">Templates</a></li>
        <div class="tab-content">
            <div class="tab-pane active" id="js-code"><pre class="sh_javascript" id="js"></pre></div>
            <div class="tab-pane" id="xt-code"><pre class="sh_html" id="xt"></pre></div>
        <!-- End source code -->


    <script type="text/javascript" id="source-code">
        function showExample() {
            var x = new Xtemplate(),
                    entry = {
                        name: 'Diego'
                    output = x.apply('#hello-name-template', entry);


    <link rel="stylesheet" type="text/css" href="" />
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>

        SourceViewer.createDisplayArea(null, 'xt', '#hello-name-template', true);
        SourceViewer.createDisplayArea(null, 'js', '#source-code');


    <a href=""><img style="position: absolute; top: 0; right: 0; border: 0;" src="" alt="Fork me on GitHub" data-canonical-src=""></a>