Build a Page Navigator using PHP + OOP

I am trying to learn PHP and OOP and thought maybe working on a “Page Navigator” would be a good place to start.

(BTW, what exactly do you call the thing that allows you to navigate from page to page?)

Does anyone know of any resources that show you how to make a “Page Navigator” using PHP and OOP?

I like the one Sitepoint has. Maybe there is sample code for how they do the one on here?

TomTees

I disagree.

The only way you can ever learn something that is complex is by doing with a good mentor by your side.

Neither driving a car, nor flying a plane, nor building a business, nor brain surgery can be done through a “connect-the-dots” book!! :lol:

Then you need to buy yourself a good book (the right book for you). Then you will buy more books, believe me, some of them will not contain examples written in PHP.

In my 10 year on-again-off-again attempts to learn OOP, I have never read a book that really “wowed” me when it comes to OOP.

Every book out there uses contrived examples and pedantic teaching styles.

That is why I’m looking for help from people who have actually used it to build real things…

[Quote]
Originally Posted by TomTees
I also think I’m going to try and get through “Head First: OOP Design Patterns”, because even if it is more advanced than I need, it will “expose” me to different ways to conceptualize classes,

You posted that on the 18th June, so tell us - how did you get on?[/QUOTE]

Well, I was true to my word and did buy and read the “Head First: Design Patterns” book. (Actually referred to it just last night!)

It was pretty well written, but it still leaves some decent gaps between book knowledge and applying things to real-world examples. (“Sim-U-Duck” just isn’t real-world enough for me?!)

And so that just proves my point that books and studying is nice, but to learn anything of substance, you either need a lifetime to fiddle around using trial-and-error OR you find people using the knowledge in real-world situations and you learn from them. (The latter is the much easier and quicker way!)

TomTees

TomTees, don’t take this the wrong way, but nobody here will be able to teach you OOP on a forum.

They will be able to give you pointers and answer specific questions.

The question has been asked before, as you know - and the answer usually comes out the same. First spend a bit of time to get to study and understand the syntax of PHP5s Object oriented code.

Then you need to buy yourself a good book (the right book for you). Then you will buy more books, believe me, some of them will not contain examples written in PHP.

Anyway, the emphasis is on you.

Lastcraft wrote the best summary of the path you will likely end up taking, it certainly summarised what I went (and am going) through.

Oh boy!

We’re not trying to put you off, just give you a heads-up on the amount of study time this takes and as Lastcraft eloquently points out, some of the frustrations and kickbacks you will suffer - until the penny really, really drops.

It is taken from a long thread entitled Time to take the OOP plunge? and is typical of scores and scores of posts I read and followed on here before taking the plunge myself.

You posted that on the 18th June, so tell us - how did you get on?

I doubt that “page navigator” will help you learn and understand OOP and why it’s used.
If you try with something such as an article script - you’ll have way more resources and ways to execute such project. Plus, it’s more fun.
Sorry for not helping you to actually get your page navigator thing going on, I’m just trying to steer you away from something I think might be bad practice.

Read this article: Perfect PHP Pagination
You can download the sample codes here

Paging itself is pretty simple its always the interface that seems to muck everyone up.

Yeah… OOP really doesn’t make thing “simpler” in that regards. Many times I will actually mock up procedural code for tasks and re-factor into object-oriented “organized” code once a full understanding of the problem and solution has been reached. In that regards I operate much like a phrase I heard in an advertising class I took in college: Say it straight, than say it great.

Maybe some people can just spool out complex logic and tasks into OO code but that just isn’t me. I approach it much like a designer sketching out the problem w/ solutions in mock-up code than sculpting it into a well organized structure with the flow of the application. Its from that process that the organization and OO structure takes form many times. When it comes down to it understanding the repetitive, dominant processes, implementation details and edge cases are key to organizing code in a well documented and self-revealing whole. In that regards its very much a subjective process for myself not an additive one.

I start with something rough but functional and chip away to work up to the well organized and balanced whole. Its not about OOP but organization and in organization OOP will reveal itself assuming a fundamental understanding has been established.

It’s script which builds a fully useable web form based on existing data (say from a database for example).

I’m actually working on one at the moment for a cms i’m building, it gets pretty mind boggling at times lol :slight_smile:

Okay.

I think most cut their teeth on a form-generator, and that’s why we no longer smile very much.

What do you mean by “form generator”?

Why is it that they no longer smile?

Paging or Pagination as its known can be a bit of a mind bender, almost as bad as classes which deal with email - 2 subjects I never, hardly ever try and help with as they are real time-sinks.

Maybe that tutorial previously posted will be a good example to prove me wrong.

I’m more than happy to start somewhere else!

If you wanna help me with my Registration Form that would be awesome! :slight_smile:

TomTees

I disagree.

I think most cut their teeth on a form-generator, and that’s why we no longer smile very much.

Paging or Pagination as its known can be a bit of a mind bender, almost as bad as classes which deal with email - 2 subjects I never, hardly ever try and help with as they are real time-sinks.

Maybe that tutorial previously posted will be a good example to prove me wrong.

That’s the spirit!!

(Your calling is definitely not in the teaching profession…)

TomTees

Well, Ernie1 posted a link to a good tutorial on Pagination and that features the Strategy pattern, the first one dealt with in that book.

So I’d say you are all set to get coding and learning.

Like I say, nobody here is going to tutor you for nothing.

If you cannot learn from trying to solve problems for yourself with a) a real-world problem that needs solving b) a tutorial and some source code and 3) probably the easiest book on patterns to learn from d) probably the most used and well documented forum conversations regarding OOP and PHP stretching back many years - then maybe perhaps you should turn your focus to other aspects of programming on the web?

I just figured it would be something simple that you could use OOP on.

I have no loyalty towards a Page Navigator!

I’d actually like help with more complex OOP issues.

TomTees