The Mojavi 3 Book Brief From Mojavi 2

 28 July 02:07   

    You should accept a appropriate butt of Mojavi2 and PHP5 afore aggravating to advancement to Mojavi3.

    If you wish a quick blast advance of Mojavi 3, see Creating Your First Module.

    Before you activate appointment your applications over from Mojavi2, create abiding whatever host youre using supports PHP5. You can amount out if your host supports PHP5 by active

     phpinfo();

    Furthermore, you charge to download and install the Mojavi3 package, which can be accomplished by traveling to this location.

    Probably the alotof important new and able aspect of Mojavi3 is the Ambience object. Already I ample out what this affair did, I fell in adulation with it. Basically, it is a array of catalyst/storage item that allows you to access:

    More or less, alotof classes that are apparent to the user/developer (you) are traveling to accept a getContext() function, which will acquiesce you to admission this object. And with the contempo accession of bottomward calls, you can accomplish operations that you were clumsy to in php4, for example:

    The Old Way:

     $obj =& $request->getAttribute(myobj);

     $anotherobj =& $obj->doSomethingSpecial();

     $anotherobj -> execute();

    The New Way:

     $this->getContext()->getRequest()->getAttribute(myobj)->doSomethingSpecial()->execute();

    Okay, so maybe that wasnt the best example, as it is rather lengthy, but you get my point, 1 band vs 3 lines, and no accessible mistakes if ambidextrous with ample altar like artful them over after references, etc.

    This annex is to be continued....

    Mojavi2 acclimated renderers to construe the API of one templating arrangement into a all-encompassing API that would calmly acquiesce a developer to about-face out one templating arrangement for another. For example, the Aloof templating engine uses $smarty->assign() to acquiesce you to set a variable, while patTemplate, addition templating system, uses $pat->addVar(). In Mojavi 2, you would then address or use an absolute renderer, which you would then adjure to affectation your output.

    Note: This was done about through a filter, which would make the renderer object, then accredit it to your $request via

     $request->setAttribute(MyRenderer,$rendererObj))

    Mojavi3 uses abundantly the aforementioned methodology, but instead of accepting the renderer anon from the $request item aural anniversary of your views, it artlessly extends the Appearance class.

    For example:

     abstruse chic SmartyView extends View

    

     accessible action setAttribute($name, $value)

    

     .....

     }

    Note: the use of

     $this->engine = $this->getContext()->getRequest()->getAttribute(MySmartyObj);

    was artlessly the best band-aid I could appear up with for accepting any item from aural the view, you could aswell accept done the afterward just as easily:

     $this->engine = new Smarty();

    The Mojavi3 Appearance is mostly an abstruse class, which provides a skeleton of functions to plan with, appropriately accouterment the unified API as was accomplished in Mojavi2 (Its unified because you are affected to accede with the allotment conventions implemented by the abstruse chic View.)

    Now, instead of intitializing your Renderer item (as you would in Mojavi2) you artlessly extend View, and initialize that. Like apparent above:

     abstruse chic SmartyView extends View

    As you can see, this is abundant added aqueous than affairs the renderer out of $request with every new View, its aswell a lot beneath cipher that you accept to archetype and paste, and appropriately beneath cipher to maintain. You may aswell accept noticed that the allotment arrangement is altered for the Views, instead of allotment the book DoSomeActionView_success.class.php you would now name it DoSomeActionSuccessView.class.php, and name the chic likewise(In Mojavi2 we just called our appearance classes DoSomeActionView, in Mojavi3 its DoSomeActionSuccessView replacing Success with your applications state).

    This annex is to be continued....

    Actions in Mojavi3 are adequately similiar to those of Mojavi2, with a few accessory and semantic tweaks actuality and there. Listed Below:

    Mojavi3 configurations are done, by default, using .ini files. This simple and aboveboard agreement makes configuring mojavi actual easy. The abject syntax of these ini files is as follows:

     [SECTION]

     ; a comment.....

     ConfigKey = %MO_APP_DIR%/my/config/value

    Because some humans ability not like ini files, Mojavi3 was created in such a way that you could address your own agreement handlers. For example, if you capital to use xml files to configure your mojavi, you could address a agreement handler, bung it in, and alpha using your custom agreement styles.

    This annex is to be continued....

    To acquisition out added about PHP5 in accepted go here: Area can I go to apprentice more?

    

 


Tags: continued, engine, files, system, example, abstract, class, allow, write, object

 mojavi3, mojavi, class, object, mojavi2, request, example, renderer, files, configuration, abstract, templating, getattribute, subsection, naming, allow, getcontext, extends, simply, smarty, engine, write, continued, system, , abstract class, ini files, templating system, class smartyview extends, smartyview extends view, abstract class smartyview, one templating system, migrating from mojavi, getcontext getrequest getattribute, book migrating from,

Share The Mojavi 3 Book Brief From Mojavi 2:
Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...

Permalink
Article In : Computers & Technology  -  Websites Help