PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Oct 20, 2018 11:18 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: AnnoLoader beta release
PostPosted: Mon Jan 17, 2011 12:53 pm 
Offline
DevNet Master
User avatar

Joined: Wed Jun 27, 2007 9:44 am
Posts: 4313
Location: Sofia, Bulgaria
http://code.google.com/p/annoloader/sou ... nnoLoader/

The problem

I have a lot of JS and CSS files needed to be loaded in a specific order based on their dependencies. I.e. an Ext.ex.grid.Panel extends the Ext.grid.Panel, so I need to load Ext.grid.Panel.js prior Ext.ex.grid.Panel.js in my HTML page. I have similar problems with CSS files - "overriding" styles should be loaded after the "original" ones.

The solution

I use PhpDoc like annotations in files that have some requirements. E.g.:

Ext.ex.grid.Panel.js
Syntax: [ Download ] [ Hide ]
/**
 * @annoloader-requires-file /Ext/grid/Panel.js
 */


In general I may have:
Syntax: [ Download ] [ Hide ]
/**
 *
 * @annoloader-requires-file 1.js
 * @annoloader-requires-file 2.js
 *
 * @annoloader-requires-class Ext.Namespace.Class1
 * @annoloader-requires-class Ext.Namespace.Class2
 *
 * @annoloader-requires-namespace Ext.Namespace
 *
 * @annoloader-requires-directory ex/grid
 *
 * @annoloader-requires-directory-tree ex/data
 *
 */


Aliases:
Syntax: [ Download ] [ Hide ]
/**
 * the same as annoloader-requires-file
 * @annoloader-after-file /Ext/grid/Panel.css
 */


Critique needed on

1. PhpUnit tests applied (AnnoLoader_Dependency_Builder_ListTest needs more testing, but I'm not sure I do it right)
2. Patterns used
3. Decoupling

TODO

More complex caching


Thank's !!!

_________________
There are 10 types of people in this world, those who understand binary and those who don't


Top
 Profile  
 
PostPosted: Mon Jan 24, 2011 12:44 pm 
Offline
DevNet Master
User avatar

Joined: Wed Jun 27, 2007 9:44 am
Posts: 4313
Location: Sofia, Bulgaria
Anyone? :(

_________________
There are 10 types of people in this world, those who understand binary and those who don't


Top
 Profile  
 
PostPosted: Wed Feb 02, 2011 7:29 am 
Offline
Forum Contributor
User avatar

Joined: Sun Jan 14, 2007 11:44 am
Posts: 104
Location: Cracow, Poland
It would be very helpful to post some examples from the PHP side, because just annotations show almost nothing, at least for me, and I could not find any examples on the project website. In addition, I think you should use PHP 5.3 namespaces, instead of the old underscore notation. More and more projects adapt it, and so should you.


Top
 Profile  
 
PostPosted: Wed Feb 02, 2011 8:00 am 
Offline
DevNet Master
User avatar

Joined: Wed Jun 27, 2007 9:44 am
Posts: 4313
Location: Sofia, Bulgaria
There is one simple example - the index.php file in the root directory
http://code.google.com/p/annoloader/sou ... /index.php

It will load all JacaScripts located in '/www/site/annoloader/scripts/test/AnnoLoader/js/ux' in order that would satisfy dependencies between them.

Another a little more complicated example:

Suppose we have:

Syntax: [ Download ] [ Hide ]
  1. scripts/ 
  2.   /ex 
  3.     /grid 
  4.       Panel.js 
  5.   /ux 
  6.     /grid 
  7.       Panel.js 


Syntax: [ Download ] [ Hide ]
$js = new AnnoLoader_Facade_JS
(
        '/www/site/annoloader/scripts/test/AnnoLoader/scripts',
        array
        (
                'Ext.ex'        => 'ex',
                'Ext.ux'        => 'ux',
        )
);

$js->output(true);
exit();

_________________
There are 10 types of people in this world, those who understand binary and those who don't


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group