I'm new to codeigniter but I wanted to create an application like that of http://redbeacon.com or http://thumbtack.com.
What is the best approach to go about creating a site like one of the above and is there any open source application I can use as a skeleton? Even a tutorial on creating a site like that would be great!
Thank you so much!
I doubt there are any specific open source solutions to your particular problem so I would say that you're going to have to create most of the site from scratch. That is, provided you have a good knowledge of PHP already.
If not, then I would suggest starting with some good php development books that will teach you the fundamentals of PHP.
For learning CodeIgniter you're quite lucky. One of the best parts about CodeIgniter is that it is very well documented.
For the quickest ramp up time I would take a hard look at Expression Engine. It is a commercial web publish tool that is based on CodeIgniter - so you get all the power of CI but with much greater ease of use. You can make pretty much any kind of site/web app with EE: showcase.
Related
Hello there I am new to php and want to learn to write reusable php code, a framework to build CMS for the sites that I am going to create.
From where should I learn such approach. If Possible please share some of the links of tutorials pdfs anything that can help me.
Try to re-invent the wheel. Read the TinyMVC source code and try building a framework similar to it. Then you can read and re-invent bigger framework. (I did this with Zend Framework, if you ask)
Of course, you should do this for learning purpose only. For your real projects, I suggest you to use existing PHP frameworks out there.
Like Michael said, don't re-invent the wheel.
You can choose from many frameworks when it comes to PHP. You might also consider using Ruby on Rails. In my experience, all 'good' PHP frameworks are just Ruby on Rails wannabes and bad at that too. But saying that is just begging for a flame war, so lets all pretend I didn't just say that.
---- on topic ----
You say that you are a beginning PHP-er and want to learn to 1. build reusable code and 2. build a CMS using 1.
An important practice of writing reusable code to me is that you split up functionality of a library you make up in as many parts as you can. To take a recent example of a digital store I am building, I would have a function that clears my shopping cart, one that clears the register one that resets the fields, etc. By splitting the code up in these different functions I was able to call some of them when a transaction was complete (with the addition of saving the transaction) and I when a search was completed (just reset the fields). Think of it like a chest of tools where you can either have screwdrivers attached to all the other tools, or you could just have 1 screwdriver. And this is just one aspect of it.
#Galwegian posted a good answer about more elements to reusable code on SO: How do you make code reusable? as well.
Learning how to build a CMS is a pretty broad question. If you were doing it just for the fun of it or just so to learn how to write better PHP; look around at what other CMSes are doing and wonder how they solved certain things, what makes them work or not and try to figure out how you can build that too.
If you want to build websites professionally; please don't create your own CMS. You will hate yourself for it later. Go for something with a wide user base and many tutorials, like drupal or wordpress. When building your own CMS you'll just be stuck wasting time finding solutions to problems that were already solved a lot better by others.
-- half topic---
I saw this PHP course coming by, it isn't free though, but it should get you started. Nettuts is a good resource for tutorials and alike either way, check it out.
http://net.tutsplus.com/tutorials/php/php-fundamentals-new-premium-course/
Why not just use one of the many many already existing PHP CMS frameworks out there?? Drupal, for example, is easy to extend. Don't re-invent the wheel.
Here is an example of Jeffery Way's tiny MVC framework which you could play with http://net.tutsplus.com/tutorials/php/create-your-first-tiny-mvc-boilerplate-with-php/
I'm primarily using Drupal and am considering moving away from CMS. If I were to build my own platform could I integrate modules like commenting systems, user login, etc. through a PHP/Python API? What would be the proper steps/good places to look/good tutorial on this? Would I have to build all of my own tables manually to suit the needs of such custom modules? I'm wondering if this would even be possible with out having to hard code all of this by hand? Thank you.
You can drop the Disqus commenting system into any site. Same with Facebook Comments.
First of all if you are considering moving away from CMS than you should consider using some sort of framework but with time you will come to idea that you need your own shit in order to be satisfied.
Second, subject you are trying to decipher is a little bit more complex than just writing it down here.
I would suggest you to first think what do you need. What is your main goal with it or what are you trying to accomplish? For example in meaning of commenting, if you want the truth nor PHP nor Python are masterpieces. Why not to consider Node.JS for that?
I mean, web is becoming real-time more and more. Now days we have scripts or to be more precise, pieces of art such as Socket.IO who can with help of Node.JS handle large amount of traffic without any problem. Something nor Python nor PHP can do.
Some stuff you will need to code by yourself but most of the time you just need to code "architecture link" between one versus many features. Eg. take some code and adjust it to be able use it from your own framework or whatever.
As far I see it. I like to do all crucial parts by myself but for example there is Zend Framework and you can use ACL + Auth library and start from there.
Hope this makes some sense. Cheers!
Comment systems
Services
Disqus
Intense Debate
JS-Kit Echo
Chirrup
InstaComment
Have a look at the comparison.
Self-Hosted
Commentator
I'm building an organization's website, that is a mixture of static and dynamic content with a bit of functionality (login, search and results, a few forms etc)
Usually I build from scratch using MySQL and PHP but I'm interested in using CodeIgniter.
Obviously the official user guide is a good place to start - Any other suggestions?
I want to make sure that I'm building it in an elegant, secure and best-practice sort of way. Though I also don't want to complicate things and bite off more than I can chew just yet :)
Here you can find a useful kick-starter tutorial on CodeIgnitor:
http://net.tutsplus.com/articles/news/codeigniter-from-scratch-day-1/
Best regards.
Are you sure you don't want to use ExpressionEngine? Then you'd have lots of CI source code to look at that created in a best-practices kind of way. Search, forms, login (member management) are already built...
For learning CI:
cheat sheet:
http://codeigniter.com/user_guide/general/quick_reference.html
http://codeigniter-resources.com/categories/tutorials
http://theyoboo.blogspot.com/2010/05/codeigniter-resourceschecklist-thingy.html
Something easy like CI (this means mandatory good, easy, up to date documentation). But also with some more features than CI.
Yii has lots of features, but it is also more complex (and it kind of forces you to have to use lots of it features). That means adding some functionality to your web-app takes three times as long because you have to figure out lots of new small functionalities of Yii.
It's kind of like the CI "gets out of your way" when it needs to, and Yii gets in your way, and if you don't do it its way, it breaks.
Features missing in CI that would be nice to have in this new "intermediate" PHP framework:
Code generation (crud).
Authentication.
Access control.
Layouts.
Widgets.
Easyer / automated pagination (like yii)
easy uri parameters
Where Yii causes me problems:
It's like for every small task there is some inbuilt functionality (this is good), but, YOU HAVE to use the inbuilt functionality, otherwise bad things happen. (CI gets out of your way, but does it too much, Yii helps a lot, but is butting in too much at times, and it forces you to sift through its documentation so that you discover these functions without which you are not able to accomplish a task that would take four time less, in CI, or in a non framework app).
Is there something in between ?
(ASP.NET MVC could be 'it', but I don't know the language, so the effort to learn it would be greater than learning Yii php framework really well, so I am looking for a PHP Framework)
I am a fan of CakePHP. I feel it has the specs you provided. If you want something more cutting edge you can take a look at Lithium
I have found some resources that kindof solve the problem, because they contain examples (Milan Babuškov's sugestion helped focus on "the solution").
Yii playground - examples
Yii cookbook - examples
Yii blog tutorial - more examples
PS. there is also google - I find solution (and examples) the fastest this way - ex: implement + pagination + yii
I've used both CI and Yii (on my own projects if that makes any difference). CI was my first introduction to MVC, and I found it easy going because it let me use any crappy structure and code. I wrote two full sites in CI (www.insolvencynews.com and www.thebigeat.com if you want to see complexity.)
I had a look at CakePHP but got NOWHERE.
Then I moved on to Yii and, like you, I found it pretty tough and rigid. But I then found that it was so powerful and extensible that I was so much more efficient. When I needed to add a few new features to the old CI sites, it was faster to rewrite the entire sites on Yii than to code up the extra features in CI.
I can't recommend a framework in the middle, but I can recommend sticking with Yii. When you say Yii gets in the way, can you give an example? Looking at DB stuff (in ascending order of dependence on Yii):
you can code using PHP's core MySQL functions.
$result = mysql_query($sql);
you can use Yii's DB abstraction layer.
Yii::app()->db->createCommand($sql)->queryAll();
You can use Yii's ActiveRecord:
Takeaway::model()->findAll();
you could try kohana (especially coming from ci)
You should check out the CI community, some of those extensions maybe have been written by someone else (I remember seeing Authentication and Components/Widgets somewhere)
Symfony is worth checking out. I personally don't like it much because they chose Prototype over jQuery for their ajax features, which is really annoying to use when you're used to jQuery.
Lithium might be good to check out too. However, it is php 5.3 only and you need to be really careful that this version of PHP is going to be supported on the server the site will be deployed on.
See this list for good comparisson:
http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks#PHP_2
From a personal point of view, I would go with symfony because of it's
rich features and
great integration with many other already bundeled components (Doctrine, Swift Mailer,..),
good (but at first complex) code generation that produces realy useable code to get you startet quickly,
powerfull use of templating (that will be the point you mention under "layouts)
many different, powerfull plug-ins, including Authentication & Access Control (it also has a plug-in to get jQuery support)
one of the best tutorials that I've seen with a framework
Downside is a
more complex structure,
IMO wired file structure,
a rather messy API documentaion compared to the tutorial
CodeIgniter is a nice framework if you don't want to create big apps but it lacks a great database integretaion and you already mentioned code generation.
im very good in Raw PHP, where the project at hand became too much to handle i decided to move to zend, with too too much complexity i finally moved to YII which really reduced the cost and overhead time for project development and most importantly for me is the simple integration of jquery, widget and advanced-OOP.
You could have a look at Qcodo / Qcubed.
They are both easy to pick up and offer code generation / ORM
Easy way to create forms in an mvc kind of way.
For what its worth, if you're looking for a PHP Framework that is like ASP.NET MVC then I think Prado is the closest thing you will find.
I'm about to start on a small, static website project: no database or CMS required. Basically, a brochure website.
I used the CodeIgniter framework recently to develop a full-blown web application, and I'm wondering if it appropriate to also use CI for smaller, simpler sites.
Typically for a static brochure site I would write regular PHP pages with a few includes thrown in to save on repetition (i.e. HTML with a sprinking of PHP), but this time around I'm wondering if my new friend CodeIgniter might be able to streamline the development process.
Is it sensible to consider a framework for such a simple project, or is it overkill? I'm worried that I might be the proverbial carpenter whose only tool is a hammer, and sees every problem as a nail!
I think almost never, the needs change and come more with time... so it is better to have a good base using a framework to wait the future needs. but if your project will not have a long live time and your needs are reaaally simples then i think is not necesary use a framework.
I personally would never develop a site outside of a framework for anything more than a single page brocure-ware site. I work so much faster inside the framework.
I'm a Python/Django developer but here's my take.
I've done some small non-framework sites with PHP and I don't know how PHP frameworks compare to DJango, but if they're anything alike the fact remains that I'm far more proficient developing within a framework than to code something from scratch by hand.
It helps me stay organized if nothing more than giving me the VC of the MVC. Django provides me with a lot of built-in tools, like form handling, that make my life much easier even for small sites.
I'm going to presume PHP frameworks provide similar things, maybe not though.
You also can't anticipate how the site will grow over time. It's easier to maintain something built in a framework, and if you ever need to extend the site in the future it's nice to have some structure behind it.
Since I tend to either inherit bespoke frameworks, or write my own, I would peg it at about 3 pages: if it's more, then setting up a framework is worth it. And if it needs a DB, then odds are good you'll end up with more than 3 pages, anyway. :-)
I recommend Rapyd, a "minimalistic and rapid PHP framework".
How long is a piece of string?
I use CodeIgniter (specifically PyroCMS) for crappy 5 page brochure-ware but that is purely to let clients admin their own pages easily with a WYSIWYG.
Any client will say "Wow, news, contact form and I can get me some of that Twitter too?!" so I just dump it in there to save everyone time.
If you are developing from scratch there is no point if the content is static. Something like CodeIgniter helps with DB interaction, Form validation and the breaking down of multiple pages into logical chunks i.e Controller classes and methods.
If you have no db-content, don't handle forms and don't have many pages then there is litterally no point adding the overhead.
That said, try my Twiny framework for literally the smallest MVC framework around.
If you don't need a database, CMS and is just a simple static HTML/css/PHP page, I don't think you can go wrong creating a site without a framework. Plus, if you have been using frameworks for a long time, you can have a break and do "code for code" and have a feel what it's like to code from scratch :)
Site is never small if the client is there who may want to ask you to add more functionality at any time :)
For a simple site like that. why even use a framework why not use something like concrete5. Overkill? definitely. but hey it is easy and requires almost no coding so upkeep is a breeze.
The site would be up and running in less than an hour and it makes you look good in the eyes of your customer and that can't hurt.!
I don't think any project is too small for a framework, I think some frameworks are too big for small projects. Everyone hopes their website will grow. So no matter how small the site is now, growth will be easier to manage if you start with a framework.
The only case when framework would be an overkill is with a throw-away scripts, such as when you need to quickly automate something that you won't need to do again ever. For anything that will enter execution cycle more then few times framework is a probably would be better.
If it requires under several hours of work - then it is small. Anyway if you plan to devote more than "several hours" - definately use a framework AND a control revision system.
It depends. If you're positive this is all the site you're working on will ever be, or migrating when future needs arise, then I can't see why there would a reason for using a framework, unless you feel more comfortable working with one.
As a personal example, I recently worked on a semi-static website, for which I put together a minimal framework which worked as a caching preprocessor for static html, inserting common html-elements into preset places. This allowed for some dynamic content, yet still using only static html for content.
I'd say you're answer lies within a formula consisting of future development needs, your own working preference, and performance.