I'm working on a website: http://tinyurl.com/9sdq3eo (I've used tinyurl as I don't want you to think I'm promoting, the website isn't even finished yet. Free2Read.co.uk for those not wanting to view on tinyurl

Anyway I'm trying to learn OOP with PHP before I delve into frameworks but I'm having excruciating trouble trying to learn it as I've been coding procedural for so long.

I gathered that instead of all of these tutorials using OOP to demonstrate static content such as houses etc they are a waste of time for me, I need something I can relate to. I get that the code is reusable and you keep hold of big scripts that you write, but trying to explain it to me using static data such as house blueprints which in the real-world I'd pull from a database it's just not getting through to me.

Could somebody take a quick look at the website above, and explain where in the site I would use OOP. The site is dynamic.

Thanks in advance.

Member Avatar for diafol

Having taken a quick tour, I can't see that there are many dynamic or DB-derived items present. The pages, except for homepage and listings are static AFAIK. It seems that you only need php/mysql functionality for updating the 3 columns in the homepage, possibly the carousel if not using js data. Categories - although this may be static. Then there are the form driven events: send content, send advert, register and sign in.

You can certainly use a user class for logging/registering. Maybe an email class with subtypes for both 'send' forms. A category class for the frontpage and listings?

I don't know if this site warrants OOP. You could do all that with a handful of procedural functions. Sorry if that's not what you want to hear, but I'd find it a bit daunting creating a bunch of unrelated classes for this. Just my 2p though.

That's all I wanted to know really. I think even making a login system using OOP would be too much effort for little return. As it stands, everything is included from 1 directory so although it is procedural, it is straight forward to maintain.

Thanks for your input.

take some framework like CodeIgniter or Yii or some else which uses OOP (I am not sure if there are those which do not use OOP). For example codeigniter has tutorial how to make simple blog. From it you will use OOP and will know at least the basics of it.
The problem with codeigniter is that sessions sometimes disappear for no reason, so user gets logged out from time to time. So maybe take not codeigniter. Other that sessions problem - codeigniter is good.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.