Mac's PHP MVC Framework with an AJAX Flat File CMS
Moderator: General Moderators
Mac's PHP MVC Framework with an AJAX Flat File CMS
Hi,
I have created a PHP MVC Framework with an Integrated AJAX Flat File CMS check it out at: http://macs-framework.sourceforge.net/ you can download it from http://sourceforge.net/projects/macs-framework/ . It is already on power with if not better than CodeIgnitor and CakePHP at its current development status, and the learning curve is much shorter as well.
Please comment if you have used the framework or have any feature requests or other comments.
Thank you,
Mac
I have created a PHP MVC Framework with an Integrated AJAX Flat File CMS check it out at: http://macs-framework.sourceforge.net/ you can download it from http://sourceforge.net/projects/macs-framework/ . It is already on power with if not better than CodeIgnitor and CakePHP at its current development status, and the learning curve is much shorter as well.
Please comment if you have used the framework or have any feature requests or other comments.
Thank you,
Mac
Re: Mac's PHP MVC Framework with an AJAX Flat File CMS
I would find this a lot easier to take seriously if you fixed the simple spelling errors in the front page of your website. I'm sure you put a lot of work into it, but if there are spelling errors, why wouldn't there be coding errors?
I'm not really trying to be rude, I just think the way your MVC is presented needs some work. I rarely download anything that seems less than top-notch professional.
Edit: I read through a few more pages of your site, and it really does look neat. I'm just a bit of a stickler for proper English and whatnot.
Mac's Website wrote:this is achieved by an advanced and
...
for examples and explinations explanations
...
is the shortist shortest
I'm not really trying to be rude, I just think the way your MVC is presented needs some work. I rarely download anything that seems less than top-notch professional.
Edit: I read through a few more pages of your site, and it really does look neat. I'm just a bit of a stickler for proper English and whatnot.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Mac's PHP MVC Framework with an AJAX Flat File CMS
Without a definitive list of pros and cons of your framework vs Cake or CI -- I find it difficult to believe you and thus warrant the time needed to download and read your code. 
I'll check it out anyways.
I'll check it out anyways.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Mac's PHP MVC Framework with an AJAX Flat File CMS
I think you would be better off listing the actual merits of your software rather than making statements that are simply not true. And yes, I looked through the code.macrob7 wrote:It is already on power with if not better than CodeIgnitor and CakePHP at its current development status, and the learning curve is much shorter as well.
(#10850)
Re: Mac's PHP MVC Framework with an AJAX Flat File CMS
Hi Guys,
Sorry If I came off as being a little bold in saying that the framework may be better than CI and CakePHP, but that is what my goal is. All I wanted to do when starting this thread is to spark a debate on what are the most wanted features in an MVC framework and what were the good and bad points of CI and CakePHP, which would help me in further development of the framework. Also there is a Flat File CMS that is built upon the framework, I did that to prove to myself that the Framework was stable and good enough not only to create websites but also full blown web applications.
I appreciate all your feedback
Thank you,
Mac
Sorry If I came off as being a little bold in saying that the framework may be better than CI and CakePHP, but that is what my goal is. All I wanted to do when starting this thread is to spark a debate on what are the most wanted features in an MVC framework and what were the good and bad points of CI and CakePHP, which would help me in further development of the framework. Also there is a Flat File CMS that is built upon the framework, I did that to prove to myself that the Framework was stable and good enough not only to create websites but also full blown web applications.
I appreciate all your feedback
Thank you,
Mac
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Mac's PHP MVC Framework with an AJAX Flat File CMS
From a quick look at your code, how would you support a second database type? Seems like you would have to actually go in and edit the framework.
(#10850)
Re: Mac's PHP MVC Framework with an AJAX Flat File CMS
Hi,
Nope, All settings are stored in one config.php class file, so all you will need to do is change the DB connection settings. The framework uses a multi-database abstraction library called dbi4php http://www.k5n.us/dbi4php.php, so what ever database types are supported by that library are supported by the framework as well.
Thank you,
Mac
Nope, All settings are stored in one config.php class file, so all you will need to do is change the DB connection settings. The framework uses a multi-database abstraction library called dbi4php http://www.k5n.us/dbi4php.php, so what ever database types are supported by that library are supported by the framework as well.
Thank you,
Mac
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Mac's PHP MVC Framework with an AJAX Flat File CMS
What if you want to use PDO or ADOdb or Doctrine or something?
(#10850)
Re: Mac's PHP MVC Framework with an AJAX Flat File CMS
Good Point, This is the kind of feedback I was looking for, currently the built in DB library does not support these types, but you can download your own DB library and load it into the Model and create something like a Base Model class, I was thinking of using some thing like http://adodb.sourceforge.net/ in the future to replace the current DB library.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Mac's PHP MVC Framework with an AJAX Flat File CMS
It your framework dependent on using your Master context class, or could you replace it with a simple Registry if you wanted to?
(#10850)
Re: Mac's PHP MVC Framework with an AJAX Flat File CMS
Hi,
The framework was built with flexibility and extendability in mind, you can do whatever you desire. The Master Class is part of the frameworks core, which provides the following:
- Interface to the template parser ( This was built from the ground up - I am confident that this is faster and I know it is not as bulky as SMARTY, it may not have all the fancy stuff that smarty has but it does what a template parser was meant to do, and there are no additional 'tags' that you must learn ).
- Helper functions to make a programmers life easier.
- Methods to load libraries, content and plugins etc.
Unlike other frameworks every model, plugin an controller have the same setup (The constructor of every model, plugin and controller must accept 1 parameter which is an instance of the Master class) which meens when you are in the plugin you can use the helper functions in the Master class to load additional libraries, parse content through the template parser, you are not limited to doing these tasks just in the controller, when I was using CI this was one of the things I found that really irritated me, because you can only load additional libraries using the controllers load method, and if you wanted to separate logic into different files you have to pass the entire controller object, just so you could do this.
This framework was created with the following goals in mind -
- Pure MVC Architecture - Using this framework introduces a programmer to the power of developing with an MVC Approach
- Highly extendable framework - This is a proven fact as the CMS solution is an extention of the framework.
- An Advance, Intelegent and scalable Template Parser Engine - The template parser was written from the ground up, the template parser by its self is only 4K in size
- Complete portibility of content ie. No configuration needed while transfering the file structure from 1 location to another - This includes moving from one domain to another or from one folder location to another, this is achieved by an advance and accurate site URL and site directory autodetection.
- Light weight - The mini version of the framework, including example files and images is only around 350K in size.
- In built SEF ( Search Engine Friendly ) and SEO Capabilities - View the Sample Website Section at: http://macs-framework.sourceforge.net/s ... /test/libs for examples and explanations
- Short learning curve - I can confidently say that the learning curve for this framework is the shortest among all the other MVC frameworks out there.
- Multi-Database Support - The framework extends upon the dbi4php library for database connections, which provides a Multi-Database Abstraction layer, it also provides some helper functions to create and execute SQL Statements ( I chose this over other libraries because it was the smallest and fastest for the amount of features it has ).
The framework was built with flexibility and extendability in mind, you can do whatever you desire. The Master Class is part of the frameworks core, which provides the following:
- Interface to the template parser ( This was built from the ground up - I am confident that this is faster and I know it is not as bulky as SMARTY, it may not have all the fancy stuff that smarty has but it does what a template parser was meant to do, and there are no additional 'tags' that you must learn ).
- Helper functions to make a programmers life easier.
- Methods to load libraries, content and plugins etc.
Unlike other frameworks every model, plugin an controller have the same setup (The constructor of every model, plugin and controller must accept 1 parameter which is an instance of the Master class) which meens when you are in the plugin you can use the helper functions in the Master class to load additional libraries, parse content through the template parser, you are not limited to doing these tasks just in the controller, when I was using CI this was one of the things I found that really irritated me, because you can only load additional libraries using the controllers load method, and if you wanted to separate logic into different files you have to pass the entire controller object, just so you could do this.
This framework was created with the following goals in mind -
- Pure MVC Architecture - Using this framework introduces a programmer to the power of developing with an MVC Approach
- Highly extendable framework - This is a proven fact as the CMS solution is an extention of the framework.
- An Advance, Intelegent and scalable Template Parser Engine - The template parser was written from the ground up, the template parser by its self is only 4K in size
- Complete portibility of content ie. No configuration needed while transfering the file structure from 1 location to another - This includes moving from one domain to another or from one folder location to another, this is achieved by an advance and accurate site URL and site directory autodetection.
- Light weight - The mini version of the framework, including example files and images is only around 350K in size.
- In built SEF ( Search Engine Friendly ) and SEO Capabilities - View the Sample Website Section at: http://macs-framework.sourceforge.net/s ... /test/libs for examples and explanations
- Short learning curve - I can confidently say that the learning curve for this framework is the shortest among all the other MVC frameworks out there.
- Multi-Database Support - The framework extends upon the dbi4php library for database connections, which provides a Multi-Database Abstraction layer, it also provides some helper functions to create and execute SQL Statements ( I chose this over other libraries because it was the smallest and fastest for the amount of features it has ).
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Mac's PHP MVC Framework with an AJAX Flat File CMS
Template libraries are notorious. Why not just use PHP as a native template language -- all the power in the world and it's free -- at least in terms of re-inventing the wheel. Google bTemplate see what I mean.macrob7 wrote:- Interface to the template parser ( This was built from the ground up - I am confident that this is faster and I know it is not as bulky as SMARTY, it may not have all the fancy stuff that smarty has but it does what a template parser was meant to do, and there are no additional 'tags' that you must learn ).
So there inside a base or master class? Surely not every instance needs access to those functions. Helper functions are usually an indication that the methods have no been properly grouped or categorized -- not saying they are appropriate being called "helpers" just make sure they are truely generic.macrob7 wrote:Helper functions to make a programmers life easier.
One thing I dislike about most frameworks. Why have a module/library loader? Whats wrong with include or __autoload???macrob7 wrote:Methods to load libraries, content and plugins etc.
As for content and plugins -- sounds more specific to a CMS than a generic application framework.
That is, I believe, where initialization should occur -- passing/injecting instances of required object to the model to remove any unnessecary dependencies the model may have on outside classes.macrob7 wrote:you are not limited to doing these tasks just in the controller
I think most are -- some are just more diligent about separation/dependencies than others. For example, your master class, sounds like it would be better off as a registry (I think arborint said that already). I would also personally rather see registry injected into the controller or model as opposed to pulled into the controller or model with a call to a static method in each base class.macrob7 wrote:Pure MVC Architecture - Using this framework introduces a programmer to the power of developing with an MVC Approach
Code: Select all
class Model_Base{
$_registry = null;
function __construct()
{
$this->_registry = Registry::getInstance(); // Bad
}
}Code: Select all
class Model_Base{
$_registry = null;
function __construct($registry)
{
$this->_registry = $registry; // Good
}
}Haha...aren't they all? If you couldn't build something ontop of a framework, it wouldn't be much of anything except a cluster of source codes.Highly extendable framework
Look into bTemplate -- I promise it's not as advanced, scalable or intelligent.An Advance, Intelegent and scalable Template Parser Engine
In short, selling frameworks is a tricky business. There are so many of them adn more are constantly popping up daily -- yours is an example.
Your arguments were typical and although logical, no more convincing than than Zend, php.MVC, CodeIgnitor, Symphony, CakePHP, etc...not to mention the various CMS frameworks, like Drupal, CMSMS, Typo, Mambo, etc...
What I'm looking for in a framework, at least in a sales pitch, is basically a simplified, well written (ie: strict conventions), loosely coupled library of components. But most importantly, a practical comparison of pros and cons between frameworks.
You nailed it once, with that comparison between CI and your framework -- with the issue of having the master class available in your models and controllers NOT just controllers like CI. Although I disagree with that requirement, that is the kind of comparison I'm looking for.
Keep at it -- keep us informed.
Cheers
Re: Mac's PHP MVC Framework with an AJAX Flat File CMS
The template parser was built from scratch no libraries were used, just native PHP.Why not just use PHP as a native template language
Code: Select all
class Model_Base{
$_registry = null;
function __construct($registry)
{
$this->_registry = $registry; // Good
}
}There is no coupling between the libraries that are included with the framework, all the libraries can exists independently of each other, that is why I provided a stripped down version which is just the framework around 350K in size and a separate download which has the libraries.
I think that the framework should not limit the developer in any way, but on the other hand the developer should be wise enough to know what functions to use from the master class and where.You nailed it once, with that comparison between CI and your framework -- with the issue of having the master class available in your models and controllers NOT just controllers like CI. Although I disagree with that requirement, that is the kind of comparison I'm looking for.
Some differences between SMARTY and My template parser is that not only is the template parsed but also the content as well, also SMARTY does not allow PHP tags in the view or content files and has custom IF and FOR loops, My question is why? why would you have a whole set of custom FOR, IF etc when you can use PHP its self It is so much faster.
The framework also includes a common CSS file that I created and my favorit JS library JQuery, also I have created a google_map JS file which makes integrating Google Maps and plotting multiple addresses on the map really simple all you will need to do is call a function showLocation([address],
Code: Select all
); and all the geocoding and plotting is handled by the Google Map library, you can see a LIVE example of a commercial application that I had built using CI that is using my google map library at: http://smilegallerypro.com/index.php/main/help/Find_Smile_Gallery_Pros
My other goal besides making a MVC Framework that is on power with CI single-handedly is to make a CMS which is on power with Modx as well :wink: I worked with mambo/joomla as well but I did not like it, the CMS outputs its own code and the code of the framework its self is poorly written, same goes for many of its modules like *cough* virtumart *cough*, the only good thing is the concept of mambots.
If anyone knows of a good Flat File CMS please let me know so I can get some ideas on how I can improve my own.
Thanks for all the feed back folks.-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Mac's PHP MVC Framework with an AJAX Flat File CMS
350K is a horrible metric to use when describing the simplicity or sophistication of a software product. My *entire* application is less than 10,000 lines and only consumes 950K -- thats including the SwiftMailer class and all documents, images, etc.There is no coupling between the libraries that are included with the framework, all the libraries can exists independently of each other, that is why I provided a stripped down version which is just the framework around 350K in size and a separate download which has the libraries.
Personally I would prefer to see SLOC as a metric although it's not the greatest either -- at least it gives some insight into complexity. That 350K could be 95% comments.
Limit no, assist by enforcing best practices, yes.I think that the framework should not limit the developer in any way, but on the other hand the developer should be wise enough to know what functions to use from the master class and where.
I don't think any framework intentionally tries to limit developers, it's just a side effect of automation.
Maybe that is a typo -- but the last time I checked Smarty did indeed allow PHP tags {php}Some differences between SMARTY and My template parser is that not only is the template parsed but also the content as well, also SMARTY does not allow PHP tags in the view or content files and has custom IF and FOR loops, My question is why? why would you have a whole set of custom FOR, IF etc when you can use PHP its self It is so much faster.
Smarty compiles (SmartyLite anyways) into native PHP templates, so the overhead of Smarty template parsing only occurs once, whenever the template changes.
ModX is/was a good example of bad techniques.My other goal besides making a MVC Framework that is on power with CI single-handedly is to make a CMS which is on power with Modx
Last time I looked:
1) They used error supression
2) The relied heavily on GLOBAL's
3) They inlined HTML with application logic
4) Inconsistencies galore
Finally, the application is buggy. The code is complex. The manager/index.php page is almost 1000 lines...
I just looked at the following code:
Code: Select all
$noAdminSql = ($_SESSION['mgrRole'] != 1)? 'mua.role != 1' : '' ;
$sql = "SELECT mu.id,mu.username,mua.fullname,mua.email,IF(mua.gender=1,'".$_lang['user_male']."',IF(mua.gender=2,'".$_lang['user_female']."','-')) as 'gender',IF(mua.blocked,'".$_lang['yes']."','-') as 'blocked'" .
"FROM ".$modx->getFullTableName("manager_users")." mu ".
"INNER JOIN ".$modx->getFullTableName("user_attributes")." mua ON mua.internalKey=mu.id ";
if ($noAdminSql){
if(!empty($sqlQuery)){
$sql .= "WHERE ((mu.username LIKE '$sqlQuery%') OR (mua.fullname LIKE '%$sqlQuery%') OR (mua.email LIKE '$sqlQuery%')) AND $noAdminSql ";
} else {
$sql .= "WHERE $noAdminSql ";
}
} else {
$sql .= (!empty($sqlQuery) ? "WHERE (mu.username LIKE '$sqlQuery%') OR (mua.fullname LIKE '%$sqlQuery%') OR (mua.email LIKE '$sqlQuery%') ":"");
}
$sql .= "ORDER BY username";
$ds = mysql_query($sql);http://shiflett.org/blog/2006/jan/addsl ... ape-string
Although not nessecarily "good" it's extremely simple solution I threw togather a while back because I needed a CMS which I could advertise as my own.If anyone knows of a good Flat File CMS please let me know so I can get some ideas on how I can improve my own.
http://www.sourceforge.net/projects/texocms
In all the CMS I have looked into, three standout as superior in terms of development:
1) Drupal
2) CMSMS
3) TypoLight
The latter is probably best designed. That author has used some interesting techniques. Pretty much the entire interface is programatically generated which allows for some interesting control over the results you see. Highly recommended.
Re: Mac's PHP MVC Framework with an AJAX Flat File CMS
Hi Guys,
I have released a new version of my PHP MVC framework: http://macs-framework.sourceforge.net/ the direct link to my sourceforge project is: http://sourceforge.net/projects/macs-framework/
New Features and changes
- Changed the XML library to use the DOMIT XML Library
- Added a sitemap.xml file
- Added Caching Capability
Thank you,
Mac
I have released a new version of my PHP MVC framework: http://macs-framework.sourceforge.net/ the direct link to my sourceforge project is: http://sourceforge.net/projects/macs-framework/
New Features and changes
- Changed the XML library to use the DOMIT XML Library
- Added a sitemap.xml file
- Added Caching Capability
Thank you,
Mac