Jump to content

My best bet? A framework? Smarty? Pear?


inVINCEable

Recommended Posts

My project is to create a basic social networking site, where users can submit their own stories and rate them (much in the same way as digg). This is a one time deal, and I would not need to re-use any of the code.

 

 

Would I be best suited using a framework such as CakePHP (I've heard they slow down considerably with large websites) or would I be best coding everything from scratch?

 

 

Thanks for any input.

 

 

P.S. If I want a custom home page based upon the network the user belongs to, should I create a basic template that selects the information I want and displays it based upon the networkid of the user?

 

 

Thanks.

Link to comment
Share on other sites

I would use a framework given your goals because developing everything yourself would require a huge time investment whereas learning how to work with a framework requires less of an investment.  There are many issues such as input filtering, routing, redirecting, session state, output escaping that you may not be interested in dealing with but must be dealt with in order to create a compelling platform.  The frameworks have already solved these problems, so at the very least you might adopt a framework and borrow many of its ideas (or even code), or you might just hack the framework to better suit your need.

 

Some frameworks are Drupal (sounds more like what you need, it is a CMS), Symfony, Cake PHP, Solar.

 

I'm not sure what sort of customization you're looking for, but I think you've got the right idea.  Create a template for what's common between all the customers so that you have a single maintenance point, and then create a new template for the custom bits.  All you'll have to do is insert the output generated by the custom bits into the general template during compilation.

Link to comment
Share on other sites

I would use a framework given your goals because developing everything yourself would require a huge time investment whereas learning how to work with a framework requires less of an investment.  There are many issues such as input filtering, routing, redirecting, session state, output escaping that you may not be interested in dealing with but must be dealt with in order to create a compelling platform.  The frameworks have already solved these problems, so at the very least you might adopt a framework and borrow many of its ideas (or even code), or you might just hack the framework to better suit your need.

 

Some frameworks are Drupal (sounds more like what you need, it is a CMS), Symfony, Cake PHP, Solar.

 

I'm not sure what sort of customization you're looking for, but I think you've got the right idea.  Create a template for what's common between all the customers so that you have a single maintenance point, and then create a new template for the custom bits.  All you'll have to do is insert the output generated by the custom bits into the general template during compilation.

 

 

 

Thank you very much for your reply.

 

 

I actually began playing around with CakePHP yesterday, and I really like it. However, I have been told, let's say that if my site reaches 50,000 users, I will take a serious performance hit... which would be a concern.

 

 

P.S. I do have knowledge of some basic PHP, database driven websites. I can build generic E-Commerce websites, and already know a bit about PHP and MySQL. I am not starting from scratch here. It would still be best to use CakePHP so I can get straight to designing the system instead of fuddling around with details like inputing data? Thank you.

 

Link to comment
Share on other sites

there's a fair few things you can do with CakePHP that can significantly increase performance. at the end of the day, it's been around for long enough, has a strong community and is considered one of the more "serious" candidates for full sites. In many ways, it's not necessarily down to the code itself as much as the server it's running on, so dont worry too much about that.

 

Cake does force some conventions onto you, such as the way you structure your application, etc but this to me is not a bad thing as making changes, switching configuration, nice clean URL's, etc is made very easy. templates come in the form of layouts/view - that is, you have a "master" file, and each page has its own "view" file - just a template. however, it uses proper PHP code instead of special tags, meaning that you wont have to mess around learning a new language.

 

validation, SQL queries (due to the way the model is structured), etc etc etc are all generally taken care of so you can jump in and get started. Run through the blog tutorial on their site, and you'll see what I mean.

 

I have a lot of time for CodeIgniter, as it's much easier to get used to and comes with LOTS more out of the box - my only problem is that it's still quite new and written by a single developer, and doesnt do as much for you automatically/instinctively (eg, with Cake, stuff you ALWAYS do, like rendering the template and displaying it to the screen, is done for you - whereas with CodeIgniter, you do that manually). As they're similar frameworks, a bit of hacking will allow you to easily use CodeIgniters really useful libraries and helpers in Cake - and if you've installed Cake and have a basic grasp on it, I'd probably advise NOT to move to CodeIgniter.

 

Don't overlook CMS/frameworks such as Joomla (which has come a LONG way since its mambo days) - there's a tonne of plugins/modules, etc for it, some of which may take care of your social networking elements for you. I swear I hated that CMS not all that long ago, but recently I gave it another blast and it's pretty good and quite easy to get into quickly these days.

 

As for smarty, it's bloated and serves no purpose other than to force you to learn a whole new syntax to do what PHP can do anyway. It doesn't offer any more seperation of presentation code from your application than PHP does, regardless of how much spin+arguments are thrown on it or how they dress it up into "tags".

 

if all of that still doesnt do the trick or help, and you need even MORE social network elements, take a look at http://www.phpizabi.net/ and see whether that covers your goals.

 

Cheers

Link to comment
Share on other sites

there's a fair few things you can do with CakePHP that can significantly increase performance. at the end of the day, it's been around for long enough, has a strong community and is considered one of the more "serious" candidates for full sites. In many ways, it's not necessarily down to the code itself as much as the server it's running on, so dont worry too much about that.

 

Cake does force some conventions onto you, such as the way you structure your application, etc but this to me is not a bad thing as making changes, switching configuration, nice clean URL's, etc is made very easy. templates come in the form of layouts/view - that is, you have a "master" file, and each page has its own "view" file - just a template. however, it uses proper PHP code instead of special tags, meaning that you wont have to mess around learning a new language.

 

validation, SQL queries (due to the way the model is structured), etc etc etc are all generally taken care of so you can jump in and get started. Run through the blog tutorial on their site, and you'll see what I mean.

 

I have a lot of time for CodeIgniter, as it's much easier to get used to and comes with LOTS more out of the box - my only problem is that it's still quite new and written by a single developer, and doesnt do as much for you automatically/instinctively (eg, with Cake, stuff you ALWAYS do, like rendering the template and displaying it to the screen, is done for you - whereas with CodeIgniter, you do that manually). As they're similar frameworks, a bit of hacking will allow you to easily use CodeIgniters really useful libraries and helpers in Cake - and if you've installed Cake and have a basic grasp on it, I'd probably advise NOT to move to CodeIgniter.

 

Don't overlook CMS/frameworks such as Joomla (which has come a LONG way since its mambo days) - there's a tonne of plugins/modules, etc for it, some of which may take care of your social networking elements for you. I swear I hated that CMS not all that long ago, but recently I gave it another blast and it's pretty good and quite easy to get into quickly these days.

 

As for smarty, it's bloated and serves no purpose other than to force you to learn a whole new syntax to do what PHP can do anyway. It doesn't offer any more seperation of presentation code from your application than PHP does, regardless of how much spin+arguments are thrown on it or how they dress it up into "tags".

 

if all of that still doesnt do the trick or help, and you need even MORE social network elements, take a look at http://www.phpizabi.net/ and see whether that covers your goals.

 

Cheers

 

 

Thank you VERY much for that reply.

 

I guess I should go ahead and give my intent right here so I can hit the nail on the head with my development process. Basically my goal is to create a digg like site, although MUCH simpler, in that no stories are linked, they are simply posted in under 500 words directly on the site itself. When a user signs up, they will pick a network, which will in turn assign a network id to all the stories they post.

 

When each user signs in they will see a digg like site, according to the network they chose. So can this be accomplished with CakePHP I guess is what I need to know.

 

 

And I have look at PHPizABI before and it really isn't what I need, since my website will not be based on friends or buddies, but rather the network you belong to.

 

 

Thanks for any further advice.

Link to comment
Share on other sites

There's not much Cake CAN'T do, to be fair. The MVC (Model/View/Controller) pattern is ideally suited to the web, which is all really Cake is - an MVC framework. It imposes a structure, gives you tools, and what you craft out of it is up to you. Frameworks in general dont restrict what you can do, they just kinda dictate how you do them - but for good reason, which you find out a few sites later when you realise you're actually using the same contact/forum/register/login, etc etc script as sites you've already done.

 

My criteria for a good framework is not necessarily whether it fits my site requirements, as most (all?) do - but:

1, code is easy to install and use out of the box

2, easy to add various components/libraries, etc to as and when you need them.

 

The hardest thing you'll find with Cake or CodeIgniter is the way the URL's are handled. If you're a big fan of $_GET, and URL's like: article.php?category_id=10&news_id=5 then forget most of these frameworks as they tend to take on a segment-like style - eg, /articles/10/5 or /articles/10/article5.htm or whatever, which can be a little confusing at first. once you get used to this approach however, you'll realise how much useless junk tends to get thrown across the URL just for convenience sake without taking into account issues with SEO.

 

ahh well. you've probably got a fair bit to work with. Like I say, give CakePHP and the blog tutorial a go and you'll see what i mean. Once you're done, head over to the Ruby On Rails site and use CakePHP to follow THEIR blog tutorial too. The syntax is different but the principles are the same - CakePHP was heavily based on Rails - so most examples are fairly interchangable.

 

Good luck!

Link to comment
Share on other sites

There's not much Cake CAN'T do, to be fair. The MVC (Model/View/Controller) pattern is ideally suited to the web, which is all really Cake is - an MVC framework. It imposes a structure, gives you tools, and what you craft out of it is up to you. Frameworks in general dont restrict what you can do, they just kinda dictate how you do them - but for good reason, which you find out a few sites later when you realise you're actually using the same contact/forum/register/login, etc etc script as sites you've already done.

 

My criteria for a good framework is not necessarily whether it fits my site requirements, as most (all?) do - but:

1, code is easy to install and use out of the box

2, easy to add various components/libraries, etc to as and when you need them.

 

The hardest thing you'll find with Cake or CodeIgniter is the way the URL's are handled. If you're a big fan of $_GET, and URL's like: article.php?category_id=10&news_id=5 then forget most of these frameworks as they tend to take on a segment-like style - eg, /articles/10/5 or /articles/10/article5.htm or whatever, which can be a little confusing at first. once you get used to this approach however, you'll realise how much useless junk tends to get thrown across the URL just for convenience sake without taking into account issues with SEO.

 

ahh well. you've probably got a fair bit to work with. Like I say, give CakePHP and the blog tutorial a go and you'll see what i mean. Once you're done, head over to the Ruby On Rails site and use CakePHP to follow THEIR blog tutorial too. The syntax is different but the principles are the same - CakePHP was heavily based on Rails - so most examples are fairly interchangable.

 

Good luck!

 

Thank you very much redbullmarky! You have provided great advice and now I have a leg up to get started in the right direction! And about the URLs you are right, I used to append the user_id, product_id, etc to the url and retrieve it useing $_GET.

 

Although one final question, I do not fully understand what you are suggesting I do with RoR? Are you suggesting I learn it? Ihave read several places that cakePHP, and various other frameworks are based off of the popular ROR, although I really dont want to have to learn rails, as it is an entirely separate language. Although I may have gotten the message wrong, were you suggesting I take a look at it or learn it?

 

 

Thanks again!

Link to comment
Share on other sites

nope - not suggesting you learn Ruby at all (personally I dont have a clue how the whole Ruby syntax works). But it's more a "thinking outside the box" sort of scenario. As CakePHP is heavily based on Rails, the structure/principles behind the frameworks are pretty much the same, apart from the language it's written in (PHP vs Ruby). I'm saying that it's possible to learn something in Rails and easily be able to apply it to Cake - and as Rails' blog tutorial includes stuff like Comments for each blog entry (like a real blog), it'll give you more of an insight in terms of how models can be glued together to automatically sort out relationships that would otherwise be dealt with by plenty of SQL table joins. I looked at the Rails tutorial vids and tutorials mainly out of curiosity as to the bandwagon everyone seems to be hopping on, but as they're alot more in-depth and functional/useful than the Cake ones, it just kinda made sense to try and get them over to Cake - which was a piece of cake (!).

 

If nothing else, it'll provide you with a decent idea of how frameworks work/can be used irrespective of the language they're written in, which is a bonus all round. Half the learning curve of a framework is understanding exactly what it can do for you.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.