Ethenis Framework

Ethenis is licensed under the MIT License


So simple, that...
Even THE Name Is Simple

Ethenis is a PHP and JavaScript framework developed with the aim of speeding up the creation of Single Page Applications. Unlike other projects, Ethenis focus on a single goal, allowing its size and execution time to be minimum and thus preventing the slowdown of our page.



↧ Download Ethenis </> Source Code on GitHub

Manual

Installation

Download Ethenis Framework, extract the package and copy all the files into the webpage main folder. After that you should have the following folder layout in it.
    --> |
        |--> content
        |--> js
        |     \--> ethenis.js
        |--> config
        |--> index.php
        |--> main.php
        \--> .htaccess
		

Ethenis uses a .htaccess file with rewrite rules, so ensure your apache is configured to read .htaccess files and mod_rewrite is enabled.



Configure Web Layout

The web layout will be set in the config file. With it it's possible to modify the animations duration, the paths the website will manage, and the menu elements.
Example:
    {
        "animationDuration" : 400,
        "scrollAnimationDuration" : 400,
        "content" : {
            "" : ["home.html", "Home"],
            "info" : ["info.html", "Info", false],
            "/^man\/\d*$/" : ["man.php"]
          }
    }
 	  		
  • animationDuration: the time in milliseconds for the fade animation between page change.
  • scrollAnimationDuration: the time in milliseconds for the "scrollToTop" animation before page change.
  • content: the content that will be public and its corresponding path.
Content entry format:
  • "<path>" : ["<file-name>[.html|.php]", "<link-string>"]
  • "<path>" : ["<file-name>[.html|.php]", "<link-string>", false]
    → The link won't be added to the navigation menu.
  • "<path-pattern>" : ["<file-name>[.html|.php]"]
    → The link won't be added to the navigation menu.


Set the main content template

All the page design will be supported by an html file template, which will define the content that will remain static in the page. This content will be defined in the main.php file.
Example
    <html>
        <head>...</head>
        <body>
            <header class="with-shadow"></header>
            <nav>
                <{ link-template }>
                    <span style="margin: 5px">
                        <{ link-text }>
                    </span>
                <{ /link-template }>
            </nav>
            <{ content }>
        </body>
    </html>
		
  • <{ link-template }>
        [html]<{ link-text }>[html]
    <{ /link-template }>
    → It indicates where to place the link elemeents and the template to follow.
  • <{ content }>
    → It indicates where to place the corresponding content.


Insert content files

The html content to be inserted with each path must be specified inside the content directory, inside its corresponding file, as it was previously specified in the config file.
The PHP and JavaScript code inside those files will also be executed.

To change the page title you have to add the following script to the content file:
<script>
    document.title = "<content-title>";
</script>
    


Ethenis PHP special functions

  • Ethenis::get_config()
    → Returns the configuration values as an array.
  • Ethenis::get_config_json()
    → Returns the configuration values as json string.
  • Ethenis::get_path()
    → Returns the actual path.