<?php $filepath = __FILE__; require(getenv("DOCUMENT_ROOT") . "/peml/pemlRender.php"); ?>
:include menu.php
:doctype
html(lang:en)
  head
    meta(http-equiv: content-type ` content: text/html; charset=utf-8)
    :css stylesheets/screen
    :css IE6 stylesheets/ie
    title peml :: reference
  body#peml
    #container
      #header
        h1 peml
      #sidebar
        :php
          $thisfile = "reference.php";
        ul
          :foreach $pages as $file => $link
            :if $file == $thisfile
              li.current= $link
            :else
              li
                a(href:=$file)= $link
      #content
        h2 Reference
        h3 like an encylopedia, only a lot shorter, and less whales
        
        hr
        
        h2 Core Syntax
        h3 Tags
        p Tags are marked by prepending a line with the name of the tag. If there is no tag name, then it is defaulted to div.
        
        .code.yiiml
          h3 peml
          :code
            h1 Page Title
            div
              h2 Title
              p Content
              p Content
        
        .code.php
          h3 PHP
          :code
            <h1>Page Title</h1>
            <div>
              <h2>Title</h2>
              <p>Content</p>
              <p>Content</p>
            </div>
        
        hr

        h3 Classes
        p Classes are specified using .&lt;classname>, and can be repeated to specify multiple classes. Note that if there is no tag name, it defaults to div.
        
        .code.yiiml
          h3 peml
          :code
            h1 Page Title
            .left
              h2.subheading.first Title
              p Content
              p.last Content

        .code.php
          h3 PHP
          :code
            <h1>Page Title</h1>
            <div class="left">
              <h2 class="subheading first">Title</h2>
              <p>Content</p>
              <p class="last">Content</p>
            </div>

        hr
        
        h3 IDs
        p IDs are specified by following the classes with a #&lt;id>. Only one id may be specified.</p>
      
        .code.yiiml
          h3 peml
          :code
            h1#heading Page Title
            .left#content
              h2.subheading.first Title
              p Content
              p.last Content
            #subcontent
              p More Content

        .code.php
          h3 PHP
          :code
            <h1 id="heading">Page Title</h1>
            <div class="left" id="content">
              <h2 class="subheading first">Title</h2>
              <p>Content</p>
              <p class="last">Content</p>
            </div>
            <div id="subcontent">
              <p>More Content</p>
            </div>
          
        hr
        
        h3 Printing PHP variables
        p PHP variables can be included by appending a = to the end of the tag identifier. 
          You can also use a = on its own on a line to signify just to print the result of 
          some php, without any tagging. If you want to have a blank div with php content, 
          explicitly declare the div tag.
        
        .code.yiiml
          h3 peml
          :code
            #content
              h1#heading= $pageTitle
              .left= $leftContent
              .right
                = $rightContent
                = getMore($arg)

        .code.php
          h3 PHP
          :code
            <div id="content">
              <h1 id="heading"><?php echo $pageTitle; ?></h1>
              <div class="left"><?php echo $leftContent; ?></div>
              <div class="right">
                <?php echo $rightContent; ?>
                <?php echo getMore($arg); ?>
              </div>
            </div>

        hr
        
        h3 Attributes
        p Attributes are placed after an id in the form of (name:value, name:value, ...).
          |Note that single-line wrapped tags *can* have attibutes, but this is currently 
          |unreliable if your attributes are complicated. You can also include php variables 
          |in attributes quickly by using name:=value.
          
        .code.yiiml
          h3 peml
          :code
            html(lang:en)
              head
                title= $pageTitle
              body#page(data-id:=$id)
                #sidenav
                  a=(href:= $linkurl) $linktext
                  a(href:http://google.co.uk ` target:_new) Google

        .code.php
          h3 PHP
          :code
            <html lang="en">
              <head>
                <title><?php echo $pageTitle; ?></title>
              </head>
              <body id="page" data-id="?php echo $id; ?>">
                <div id="sidenav">
                  <a href="?php echo $linkurl; ?>">
                                            <?php echo $linktext; ?></a>
                  <a href="http://google.co.uk" target="_new">Google</a>
                </div>
              </body>
            </html>
        
        hr
         
        h2 SCL syntax
    
        h3 Flow control
        p The SCL wraps the foreach, if/elseif/else, while, and for constructs into commands
    
        .code.yiiml
          h3 peml
          :code
            ul
              :foreach $users as $user
                li
                  p= $user->name
                  p.profile
                    :if $user->hasProfile()
                      = $user->profileText
                    :else
                      No user profile.

        .code.php
          h3 PHP
          :code
            <ul>
              <?php foreach($users as $user): ?>
                <li>
                  <p><?php echo $user->name; ?></p>
                  <p class="profile">
                  <?php if($user->hasProfile())
                    echo $user->profileText;
                  else
                    echo 'No user profile.'
                  ?>
                </li>
              <?php endforeach; ?>
            </ul>
      
        hr

        h3 :php
        p This is a general block command for enclosing some raw php code.
        p The block exits once the indentation drops below where the :php command was stated.

        .code.yiiml
          h3 peml
          :code
            :php
              function fetch_text($param) {
                return $param . " is param.";
              }
              $text = fetch_text("default");
              $q = isset($_GET['q']) ? $_GET['q'] : $text;
            input(type:text ` value:= $q)

        .code.php
          h3 PHP
          :code
            <?php
              function fetch_text($param) {
                return $param . " is param.";
              }
              $text = fetch_text("default");
              $q = isset($_GET['q']) ? $_GET['q'] : $text;
            ?>
            <input type="text" value="?php echo $q; ?>" />

        hr
        
        h3 :code
        p Used to print code out, will preserve whitespace inside the block and encode HTML entities.
        
        .code.yiiml
          h3 peml
          :code
            :code
              preserve    whitespace
                      and
              <?php echo "don't execute" ?>
              <b>or tags</b>
            
        .code.php
          h3 PHP
          :code
            <?php echo "<pre>" . htmlentities(
            "preserve    whitespace".
            "        and".
            "<?php echo \"don't execute\" ?>".
            "<b>or tags</b>") . "</pre>"; ?>
    
        hr
            
        h2 SCL helper commands
    
        h3 :js and :css
        p Used to add a &lt;script /> or &lt;link /> tag. The :css also takes an optional prefix 
          to the path of "IE", "IE6" or "IE7" to add a conditional comment around the link.
    
        .code.yiiml
          h3 peml
          :code
            head
              :js /script/jquery.min
              :js /script/site
              :css /stylesheets/main
              :css IE7 /stylesheets/ie

        .code.php
          h3 PHP
          :code
            <head>
              <script type="text/javascript"
                                src="/script/jquery.min.js" /></script>
              <script type="text/javascript" src="/script/site.js" />
                                                              </script>
              <link rel="stylesheet" type="text/css"
                                          href="/stylesheets/main.css"> 
              <!--[if IE 7]><link rel="stylesheet" type="text/css"
                                href="/stylesheets/ie.css"><![endif]-->
            </head>

        hr
    
        h3 :doctype
        p Used to add a doctype to the top of a file. Options: 'html4 strict/transitional/frameset', 'xhtml 1.0 strict/transitional/frameset', 'xhtml 1.1' or blank for the HTML5 doctype.
    
        .code.yiiml
          h3 peml
          :code
            :doctype xhtml 1.0 transitional

        .code.php
          h3 PHP
          :code
            <!DOCTYPE html PUBLIC
              "-//W3C//DTD XHTML 1.0 Transitional//EN"
              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

        :clear

        h3 :clear
        p Shortcut for a standard markup clearing div. Note: you should have a clear class defined.
    
        .code.yiiml
          h3 peml
          :code
            :clear

        .code.php
          h3 PHP
          :code
            <div style="clear">&nbsp;</div>
          
        hr
              
        h2 Other commands
        p The SCL is being improved upon gradually, so there may be useful commands available that
          aren't documented here. So please review the SCL.php Library, both to check for functionality,
          and also to learn how to extend peml yourself.
        
      #footer All page markup is available by <a href="<?php echo $thisfile; ?>?source">adding ?source</a> to the end of the url.
    :ganalytics UA-13129098-1