ziimple/grypthon

This package is abandoned and no longer maintained. No replacement package was suggested.

Grypthon is a templating engine for easy HTML deployment inspired from React to allow a more declarative approach to website on server side./

This package has no released version yet, and little information is available.


README

Grypthon is a lightweight templating engine allow to declare most of the data to publish as HTML and send back to HTTP server for communication. It is use coincide with the Zimplify/Icing Project.

Here is the most minimal file you need to have Grypthon page running (Our typically Hello World example):

<?xml version="1.0" encoding="UTF-8"?>
<page id="demo">
    <layout>
        <control id="display" type="display.text">
            <data>#Hello World!</data>
        </control>
    </layout>
<page>

Want to see the real thing in action check out our solution site on Zimplify. The WHOLE thing is built with Grypthon with no real additional code except the CSS.

Install Grypthon

Grypthon is available right on composer so simply do:

composer require ziimple/grypthon

If you want to whole directory structure and the rest of the goodies, then you can also use another project of our Icing which include all the directory strucutres and basic router files that can get your site up even faster.

Key Details

Structures

To make designing with Grypthon easier, the structure is divided into:

A: Controls - the things you see in a page (input boxes, text, images, etc) B: Composite Controls - When you organize a bunch of controls together (like a form, a section, etc) C: Page - The basic grouping per HTML file that you need to display out to user. D: Template - This is the looks and feel part of the site E: Theme - This is the master of the look and feel which is common across all pages F: Wireframe - This is a Grypthon internal file that we use to make sure you get all the needed JS and CSS files to start off with

One thing to note, Grypthon supports cascading template, means that one page can pass through multiple templates until it output to the user. Here is the logical trend of how it can be applied.

  1. You design a form for people entering their choice in a survey (Page)
  2. On top of that you embed that into a document template that include a bunch of goodies that like file upload, like/share buttons and so forth (Template)
  3. After that you apply the look and feel of your site (Theme)
  4. Grypthon bundle them together and send back (Wireframe)

Keep in mind the template itself is optional, you can directly go from Page to Theme and it is completely ok.

Controls

Controls is an essential part of Grypthon, and to speed your way into development, we have prepared a bunch of pre-built controls so you do not need to worry about unnecessary code.

But if you need want to do some magic and create your own control, simply make sure you store then under <root of your site>/usr/snipplets, it will be read into your site via Grypthon. Note that, we use APCu to cache most our code so whenever you add new controls into your site. It does not get cached unless you reload the webserver.

Here is an example of a control snipplet:

<div {{=empty($id -ne nul, #id="{{$id}}, nil)}}>Hello World Control</div>

The {{ }} tags are accessor to Grypthon syntax which include:

# for any unmanaged data you want to send (it can be HTML also) @ for control properties like @id $ for class properties = for macro like functions such as sum,average,now,empty. For more simple goto Zen and check out what else you can use.

On top of this we also have some other tags you can use:

input:: for global variables that you need to access. By default, Grypthon uses css for CSS data to add to compilation, js for javascript and entry when we need to do cloning of controls. parent:: is to access page/template level variables that is one level above. ancestor:: accessing to the page level variables image:: to access image files that is either statically or dynamically called nil to send an empty value syn:: to access your syntax library - when you do multilingual site, this is the key!! data:: to access dataset if you do grab your stuff from somewhere.

Page

To store your pages, make sure it is stored under <root of your site>/usr/pages and once done the page should be accessible when you enter <your domain>/page_name on your browser.