Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Coding Releases
You last visited: Today at 11:57

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[RELEASE] Alexya Framework - Lightweigh PHP Framework

Discussion on [RELEASE] Alexya Framework - Lightweigh PHP Framework within the Coding Releases forum part of the Coders Den category.

Reply
 
Old   #1
 
manulaiko3.0's Avatar
 
elite*gold: 0
Join Date: May 2014
Posts: 657
Received Thanks: 1,146
[RELEASE] Alexya Framework - Lightweigh PHP Framework

Hi!

I've just finished a framework I was working on and decided to release it.


I'll put the github link over here: and you'll check it, once I get back home I'll post a tutorial.


See you!
manulaiko3.0 is offline  
Thanks
3 Users
Old 07/09/2015, 02:43   #2
 
manulaiko3.0's Avatar
 
elite*gold: 0
Join Date: May 2014
Posts: 657
Received Thanks: 1,146
I've made a quick tutorial to help you getting started, when I have more free time I'll write the whole documentation.

Here's the tutorial:


See you!
manulaiko3.0 is offline  
Old 07/13/2015, 22:38   #3
 
manulaiko3.0's Avatar
 
elite*gold: 0
Join Date: May 2014
Posts: 657
Received Thanks: 1,146
New release, version v0.2.0 (Blazed), download from github:

Changelog:
  • Added support for Smarty variables
  • Added support for default route


How to use Smarty variables
There are 2 kind of Smarty variables in Alexya:
  • Global Variables
  • Local Variables

Global Variables
A global variable is a Smarty variable that is accessible in all views, for example the default variable URL is accessible in ALL views of the project, you can use like this:

HTML Code:
<!-- File Test.tpl -->
<a href="{$URL}">Home page</a>
HTML Code:
<!-- File Test2.tpl -->
<a href="{$URL}Login">Login</a>
To declare a global variable you must add it to the array "SmartyVariables", the key is the name that will be used in Smarty and the value is the value (logically). To add a global variable you must do this:

PHP Code:
//File index.php
$SmartyVariables["test"] = "Testing global variable";

//Usage example:
/*
<a href="{$URL}">{$test}</a>
*/ 
Adding global variables inside a function or a class is kinda similar:
PHP Code:
class Test
{
    public function 
addVariable($name$value)
    {
        
$GLOBALS["SmartyVariables"][$name] = $value;
    }
}

function 
anotherWayToAddVariable($name$value)
{
    global 
$SmartyVariables;

    
$SmartyVariables[$name] = $value;

Once you've added the variables to the SmartyVariables they can be used in ALL views.

Local variables
A local variable is a variable that can be accessed just in one view.
To add a local variable you must add it to the array SmartyVariables inside the Model class:

PHP Code:
class Model_Test extends Core_Model
{
    public function 
__construct()
    {
        
$this->SmartyVariables["test"] = "Test local variable";
    }

And that's it, there's no need to make the $SmartyVariables array since is already declared in the base class Core_Model.

Default route
Sometimes you'll need a default action to execute if the Router didn't match any route, if so, you can use the "default" route:

PHP Code:
$Router->add("default", function() {
    die(
"No routes matched the request, please go back and try again!");
}); 
And that's it, there's nothing else to do, the "default" will be executed only if there's no matching route.
If there's no default route and the route didn't match any route added, Alexya will throw an exception saying so.

See you!
manulaiko3.0 is offline  
Thanks
2 Users
Reply


Similar Threads Similar Threads
[Need Help]S4L - .Net Framework
01/21/2014 - S4 League - 13 Replies
Hallo Leute ich hab schon wieder nen Problem q_q http://www7.pic-upload.de/19.01.14/ptpg7pj5bfn4.j pg Obwohl ich das Installiert habe http://www7.pic-upload.de/19.01.14/hwtzxx1sx7d5.j pg Danke schon mal für euere Hilfe
Net Framework 3.5
01/01/2012 - 9Dragons - 6 Replies
Uhm could som1 give me a link to net framework 3.5, im using Windows XP SP2, the microsoft site aint working...:handsdown:
Need Help - Net Framework
11/16/2010 - WarRock - 3 Replies
Heaai Leute , ich habe win7 (32bit glaube) vor 2 tagen hab ich mir net framwork instaliert um mal wieder zu hacken , seid ich net framework instaliert habe funktioniert kein einziger hack obwohl es ja heist 'wenn ein hack nicht funzt musst du net framework instalieren' kann mir jemand dabei helfen ? würe nett , gebe bei hilfreichen beitrag ein *thanks* :p
Net Framework
03/17/2010 - WarRock - 6 Replies
Hi , hab n problem bei meinem pc... wenn ich irgendeien hack starten will kommt : Net Framework initialization Error... und ich müsste die nächste version von Net framework 2.0.50727 installieren die is aber nich auf meine pc vorhanden..-.- was soll ich tun????



All times are GMT +2. The time now is 11:57.


Powered by vBulletin®
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2023 elitepvpers All Rights Reserved.