Xyndravandria Averazain
Alpha 0.0.0
|
Xyndravandria is the name of a collection of projects designed and developed by Mauro Di Girolamo (mauro); he is therefore the copyright (c) owner of Xyndravandria itself and all of its projects. digi rolam o@we b.de
Xyndravandria Averazain is released under the terms of the Xyndravandria PHP License (XyndravandriaPHPLicense.txt). You should be given a copy of the Xyndravandria PHP License (XyndravandriaPHPLicense.txt) within the same directory as the README.md; if not, you can get a copy at http://Xyndravandria.ohost.de/XyndravandriaPHPLicense.txt . There might be a release under a freer license for a later, more stable version.
All projects:
Project | Language | Description |
---|---|---|
Xyndravandria Averazain http://github.com/MauroDiGirolamo/Xyndravandria_Averazain | PHP | Averazain is an Ajax framework supporting also JavaScript disabled clients perfectly - including search engines like Google. |
Xyndravandria Dyverath http://github.com/MauroDiGirolamo/Xyndravandria_Dyverath | PHP | Dyverath is a database access wrapper. |
Xyndravandria Erozaver http://github.com/MauroDiGirolamo/Xyndravandria_Erozaver | PHP | Erozaver is a class extending the type hinting given by the PHP engine (additional support for basic type hinting and size constraints). |
Xyndravandria Mondraviel http://github.com/MauroDiGirolamo/Xyndravandria_Mondraviel | PHP | Mondraviel is a class used to separate HTML from PHP code by firstly register models - files containing place holders embedded in HTML code - and then later fill them dynamically with content by passing values for the place holders. |
In the following, the usage of Averazain will be explained roughly; if you would like to know more detailled information, you can take a look at the in-depth documentation by browsing through either the namespaces or the data structures in the navigation above.
Averazain is an Ajax framework. That said, it will manage both Ajax requests and responses for you; you will only have to write PHP code. Furthermore, it features automatic support for JavaScript disabled clients, so you do not have to fear that your website can not be displayed on clients without JavaScript (for instance search engines visiting your website).
Averazain will transfer given PHP classes into correspondent JavaScript classes offering the same methods (by name) like the original classes.
Then, you are able to call these JavaScript methods and Averazain will then call the appropriate PHP method and return its output as a response to the client.
Please read the documentations of
If you are unsure how to achieve a perfect support for also JavaScript disabled client, you can use the HTMLBuilder. It offers methods to create HTML ensuring that your website can also be used without having JavaScript enabled.
Please read HTMLBuilder's documentation - it will not only give you an overview of the different methods, but also explain how the support for JavaScript disabled clients is realised technically.
Be aware that the target of an Ajax response is passed within the response at the end of the actual text with a leading $. Considering a response text is "What a wonderful world!" and its target would be "Main", the actual Ajax response will be "What a wonderful world!$Main". "Main" would be read out by calling the Target( ) method and added by Averazain before sending the response. On client level, Averazain will read out the target and remove the postfix from the response text. But before Averazain does so, it will check whether there is already a target set at the end of the method's return value. And that is where you come in: If your methods return not only the actual text, but also already the target with a leading $ at the end of the actual text, you can change a method's target on runtime level.
For a better understanding, you can take a look at the following examples.
Maybe you would like to test the examples also with disabled JavaScript; and feel free to hit the reload button to test the anchor feature.
The examples are also useful to understand how to make your website work also on JavaScript disabled clients.
<?php ###################### # BasicUsage.php # ###################### require_once( 'Xyndravandria/Averazain/Implement.php' ); use Xyndravandria\Averazain\Averazain; use Xyndravandria\Averazain\PageCollection; use Xyndravandria\Averazain\HTMLBuilder; abstract class Website implements PageCollection { public static function Welcome( ) { return 'Welcome!'; } public static function Test( $Value = '' ) { return 'This is a test.<br>Value: ' . $Value; } public static function Random( ) { return rand( 0, 10 ) . '$' . ( rand( 0, 1 ) == 1 ? 'Main' : 'Sub' ); } public static function Anchor( $Method ) { return $Method; } public static function Authorise( $Method ) { return true; } public static function Target( $Method ) { return 'Main'; } } Averazain::Execute( Averazain::AutomaticallyRegisterClasses ); echo Averazain::JavaScript( ) . 'Main<div id = "Main" style = "border: 1px solid black; padding: 1em">' . ( Averazain::AnchorRetrieved( ) ? Averazain::CallAnchoredMethod( ) : '' ) . '</div><ul> <li>' . HTMLBuilder::Hyperlink( 'BasicUsage.php', 'Website', 'Welcome', 'Be welcomed' ) . '</li> <li>' . HTMLBuilder::Hyperlink( 'BasicUsage.php', 'Website', 'Test', 'This is a test' ) . '</li> <li>' . HTMLBuilder::Hyperlink( 'BasicUsage.php', 'Website', 'Test', array( 'SomeValue' ), 'This is a test with argument' ) . '</li> <li>' . HTMLBuilder::Hyperlink( 'BasicUsage.php', 'Website', 'Random', 'Click me many times! Random return value and random target!' ) . '</li> </ul>Sub<div id = "Sub" style = "border: 1px solid black; padding: 1em"></div>'; ?>
<?php ################ # Form.php # ################ require_once( 'Xyndravandria/Averazain/Implement.php' ); use Xyndravandria\Averazain\Averazain; use Xyndravandria\Averazain\PageCollection; use Xyndravandria\Averazain\HTMLBuilder; abstract class Website implements PageCollection { public static function ProceedForm( ) { echo '<pre>'; \var_dump( Averazain::FormData( ) ); return; } public static function Anchor( $Method ) { return $Method; } public static function Authorise( $Method ) { return true; } public static function Target( $Method ) { return 'Main'; } } Averazain::Execute( Averazain::AutomaticallyRegisterClasses ); echo Averazain::JavaScript( ) . '<div id = "Main">' . ( Averazain::AnchorRetrieved( ) ? Averazain::CallAnchoredMethod( ) : '' ) . '</div>'; $InnerHTML = 'Name: <input type = "text" name = "Name"><br> Gender: <select name = "Gender"><option></option><option>Male</option><option>Female</option></select><br> Describe yourself:<br> <textarea name = "Description"></textarea><br> <input type = "submit">'; echo HTMLBuilder::Form( 'Form.php', 'Website', 'ProceedForm', $InnerHTML ); ?>