Using Your Classes
By admin • Apr 16th, 2008 • Category: 2.1.3. ClassesOnce you’ve got those classes written, you can sit back and enjoy making the classes do all the hard work for you as you go about making screens that users will interact with in order to manage content. If you have well written and flexible classes, writing your application screens can be a real joy because the classes have simplified a lot of the hard work you would have had to do.
Example: Want a list of all the Pages in the system? Assuming your class function is written to return an array of Pages, and is called ‘db_select_all’, you can just call them as follows:
<?php $page_array = Page::db_select_all(); //yay, now you have an array of all your pages that you can do stuff with ...how easy was that! ?>
What Exactly Is ‘Beyond’?
Writing an Interface
So you’ve got classes and a database, the next step you need to master is design. You need to create screens that your users can interact with in order to manage content, so knowing HTML (in the case of web applications) is pivotal. But don’t stress, HTML is easy to learn. If you can master TABLES, you can position things pretty much however you like, and learn some basic CSS (Cascading Style Sheets) and you’ll be able to pretty up those screens so users actually enjoy using your system
User Interface Design
Knowing HTML is only part of the equation. You need to have a good grounding in user interface design, which is how easy and intuitive the screen is for a user to manage. If you have an ‘all in one’ list and details screen, things can get crowded and confusing if you’re not careful. Where do you position those buttons to Save/Cancel? What do you call those buttons? What colours do I use for maximum effect? How do I lay out my form fields and labels? How do I structure a good menu system? All fun questions that you need to think long and hard on
Integration of PHP into HTML
Once you have some basic screen design experience, you need to learn to integrate PHP scripting into those designs, to actually make the screens function. There’s a lot of debate in industry as to whether this scripting should be kept completely separate from the design, or integrated. I’m an integrated fan, simply because I know HTML, CSS and PHP inside out so I don’t need to keep PHP separate from my HTML because I understand what everything’s doing. I strongly urge you to know that combination of technologies inside out also, it will give you a good edge when it comes to web applications. If, however, you are paying a designer to design your screens and they don’t know or want any PHP scripting interfering with their pretty designs, you need to use separate PHP response pages to handle all the form requests and use as little PHP scripting in the design pages as possible, not a fun task. If you learn HTML yourself, I think you’ll find the integrated method far more flexible.
admin is
Email this author | All posts by admin
