#1
Posted 18 May 2012 - 07:29 AM
I have started learning Codeigniter recently also with a view to creating my first web 'application' (if I have grasped the correct meaning...)
The idea being that it will take the form of a community website with users and that content will be created on the fly rather than through a "back-end".
Now I am pretty sure that PW can manage something on these lines, I was just looking for some good, experienced, honest input from the great community here on the differences between building this with PW or CI.
Differences that I can see from the start -
PW provides an admin side
CI provides several helper classes for things like email and forms
#2
Posted 18 May 2012 - 11:00 AM
#4
Posted 18 May 2012 - 01:52 PM
Perhaps I should ask more for your views on PW vs PHP Frameworks in general?
When would you stop using PW and say "a framework makes sense here?"
Also do you see having an MVC approach as better for applications?
Thanks again for your views.
#5
Posted 18 May 2012 - 04:06 PM
Ryan, actually, I think Pete was the first person in here to mention using Flourish with PW, but I didn't know that when I started posting about it.
Cheers - I'd be nowhere without your wrapper though
To be honest I can't envisage many scenarios where I wouldn't use PW, unless it was for something very specific like forum software (and even then apeisa has made a forums module).
I personally never got into MVC as I found it too rigid for my liking, though that does potentially lend itself to a cleaner workflow when you're part of a team (it still depends on how well documented and presented each team members' code is though
I would say that the answer to your question depends greatly upon what sort of application you are looking to build. Can you give us any examples?
Using some real world apps as examples:
- If I was building something like Freshbooks I'd use custom tables for the invoice data, but I'd be tempted to use PW for user accounts, and store additional user data with that account data. The bulk emails could easily be handled by Flourish.
- If I were doing something more specific like creating a project management system like ActiveCollab I reckon I could do it in PW despite the complexities of what you can do in AC, but why reinvent the wheel?
- If I was building a portal for estate agents like RightMove (and the thought has crossed my mind) then that would be ideal for PW (and a bit of Flourish) and I'd just need to create a front-end interface for the estate agents to log into and manage their own property's which, again, is relatively easy with PW. The front-end of the site would then be pretty similar to something like this site ryan created: http://www.villarental.com/
#6
Posted 18 May 2012 - 04:08 PM
MVC approach has clear benefits, but don't sweat it too much; separation of concerns is what's important -- when implemented properly, you don't need to make changes to multiple places every time your UI or DB (or business logic for that matter) changes slightly. I'd recommend reading this (old but still good) post about Rails development, which (imho) summarizes benefits of MVC / separation of concerns pretty well: http://weblog.jamisb...oller-fat-model.
For the record, I've never tried Codeigniter myself and don't really know much about it. I've used Zend Framework for various projects -- and will definitely keep using it whenever it's the best tool for getting the job done -- but I've heard it has somewhat steep learning curve compared to some other frameworks. I'd still recommend checking it out though: http://framework.zen...n/learning.html.
#7
Posted 18 May 2012 - 04:37 PM
PW gives you (that are missing from many more traditional frameworks):
- Admin, users and access management
- UI for building your data schema (clicking on admin instead of coding)
- Url mapping to pages (no need to define routes)
- PW API == GOOD ORM
- Controllers == template files can be easily used as a controllers
- Crazy amount of helpers (as others have noted, using zend classes or flourish can be good help in that kind of situation)
- Routing (I hate doing routes... mostly repetition)
- Custom template languages
- Strict rules how to construct your code
What pw "requires" that you might not like in your app:
- Unique database schema: you don't have single "posts" table, instead you end up with field_title, field_body, field_author, field_date etc.. tables
- MySQL, MyISAM
#8
Posted 18 May 2012 - 06:17 PM
#9
Posted 19 May 2012 - 04:36 AM
The app in this instance would be a community type.
But I must stress I'm using this as much as a means to learning as anything else.
I think right now my thinking is:
I love PW's API - if I want to display the last 10 comments from all users on the home page, is it really easier to create a function in a model called "get_last_10_entries" then to call it in the controller? Or is it not just simpler to call it in place in the home page template? My thinking is the latter though that could be my inexperience and lack of best practices.
Having said that, as much as I love getting content from the API, forms, emails and validations leave me shuddering.
I guess a mix of the two does sound exciting but is it reasonably easy to implement that with PW? Is it even desirable?
Thanks again!
By the way that VillaRental website of Ryan's is very impressive!
#10
Posted 19 May 2012 - 05:05 AM
The app in this instance would be a community type.
But I must stress I'm using this as much as a means to learning as anything else.
I'm glad you stressed that as depending on what you were after I might have suggested other ways of doing a community site (the easiest being using something like the community suite - forums, CMS etc - here: http://www.invisionpower.com/ since they're pre-built and function together well. But then you'd be at the other end of the scale from PW in terms of customisability and ease of use if you wanted to do anything outside of what the core package handles).
To learn PW, my aim was to rebuild StrategyCore in PW as I could see how to do everything in my head and it was just a case of working it all out. It really helps to have a project in mind that you've got no set deadline for when you're learning something new, as long as you've got the time to do it. I ended up spending about 3 months' of evenings on that site, but I'll stress that easily half of that was just trying to get the forum software integrated in terms of article comments and user logins, so PW was the easy bit, including importing all the content from the previous system.
The beauty of having done that is that I now have a decent code-base for those projects in my head that are mostly community-based sites with core functionality something along the lines of ryan's sites.
I love PW's API - if I want to display the last 10 comments from all users on the home page, is it really easier to create a function in a model called "get_last_10_entries" then to call it in the controller? Or is it not just simpler to call it in place in the home page template? My thinking is the latter though that could be my inexperience and lack of best practices.
I ended up with quite a lot of code in my head.inc file that's used on various different templates. I just pulled all of that out as it was getting quite messy and stuck it into a global.php file instead in the templates directory. If you have code specific to different templates that you don't want to clutter up the template itself the you could easily create a "controllers" subdirectory and put it in there. Theoretically the easiest way to go about it would be to create that "controllers" subdir and put in a file for each for your templates with the same name, then in head.inc do something like:
include('controllers/' . $page->template . '.php');And you've successfully split out most of the code from your templates with minimum effort
I guess a mix of the two does sound exciting but is it reasonably easy to implement that with PW? Is it even desirable?
What I've just suggested above would be desirable on my website because I have so many templates that it would have been better to split it all out a bit and not have so many loops or selectors happening in the template itself. Instead I could have separated much of that out as I honestly scratch my head a few times when looking back through some older templates I'd made. That said, it depends quite a bit on how complex the project is and what your preferred method of working is. For a simple website I wouldn't bother doing the above, but for a site with section-specific, complex structure then it could well be worth it.
If you're working in a team of one, then it's up to you how you go about it and I often find myself falling into the bad habit of mixing and matching ways of working within a single project as I learn new things - fine for my own stuff, but crazy if someone else has to work on a project (fortunately they don't).
By the way that VillaRental website of Ryan's is very impressive!
I think that after watching the video on the PW homepage it was that site, plus tripsite.com (another of ryan's creations for a client) were the things that really drew me in to PW. I've got so many projects in my head along those lines and I just need time to work on them. Some of them might even make some money if I stop working on hobby sites
#11
Posted 19 May 2012 - 06:11 AM
A relatively new framework that i really like and just makes sense is http://laravel.com (excellent intro tutorials at http://daylerees.com/ )
#12
Posted 19 May 2012 - 08:59 AM
I also heard good things about http://kohanaframework.org/, but their docs and community have the reputation of not being very helpful.
Anyway, I start suspecting that you can do everything with PW
#14
Posted 19 May 2012 - 10:49 AM
CI is the most beginner friendly, the docs are excellent, I just got a bit confused by the way they implement sessions.
Kohana - not being a snob but one look at the home page and I was out of there
Yii - seems like a totally different way of building and not sure I'm up for that right now
Laravel seems incredibly promising and the docs are pretty good, doesn't seem to have an email 'helper' though I think it can be accessed via a bundle
Cake - just checking out now.
#16
Posted 19 May 2012 - 11:35 PM
Edit: onjegolders, also look at this article.
#17
Posted 20 May 2012 - 01:24 PM
Considering that Processwire is a framework itself, in my humble opinion the most beneficial way would be to use PW with decoupled framework that can be used as a component library as well, so one could pick and choose useful components without the need to load the whole framework.
What are the components that people find useful in these frameworks? I know email and forms were mentioned previously. E-mail is something PHP does quite easily and well just with it's mail() function (though I understand some like to use alternate sending systems). When it comes to form systems, I don't feel like I've ever come across one that didn't leave me feeling like I wished I'd just built the form from scratch... though I'm working on something in that regard. But beyond email or forms, what are the components that people use in these frameworks? The only other component I commonly include in my ProcessWire installations is the Snoopy() class, for doing http requests. Beyond that, I've rarely come across a need to have other PHP components in my applications. Still, if there are some really common needs, perhaps we should look at expanding PW's performance as a framework and including more helpers/components for common needs. I'm just not sure what the needs are yet.
#18
Posted 20 May 2012 - 02:01 PM
But to answer more directly to your question Ryan: what I have used and found beneficial over the time on frameworks I have used: forms, input validation, file uploads, pagination, cache, authentication... I think pw already has pretty good balance on this and I haven't had need to use any other frameworks or helpers when using pw, so probably best answers comes from people who have used flourish and pw for example. But maybe validation class is something I would like to see in PW.
#20
Posted 21 May 2012 - 02:58 AM
What are the components that people find useful in these frameworks?
Individual framework components I've used in other projects include forms, database tools, i18n and l10n, authentication / authorization / session management and filters. These are all things that PW handles itself, so I don't really see much need for them anymore.
Things that I do still find useful, coming from Zend Framework, are it's web and web services components, such as Zend_Feed, Zend_Gdata (Google API tools) and HTTP, REST and XML-RPC clients. Also I could see some use for it's server tools, though I do admit that I've never had to use them before
Things like "Because I use this DB class from this framework, it does take care of this and that security issue". So when you are not that seasoned developer, it is nice to have something to guide you.
@apeisa, that's a very good point, though I'd leave the "when you are not that seasoned developer" part away to keep things simple -- security experts (and common sense) have taught us that we shouldn't reinvent the wheel, even if it's fun. If we do, we're most likely going to make same mistakes that others have made (and fixed) before us. Not to mention that especially on client projects where time and money are limited a framework can lower production costs considerably and still keep quality high.
Naturally all of this mostly applies to serious stuff, client projects etc. Personal projects are very different matter
Also tagged with one or more of these keywords: codeigniter
Community Support →
Getting Started →
Easiest Way to Include Assets in a top-level directoryStarted by ruzel, 14 Feb 2013 |
|
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













