I've revised my development style after a lot of thought. Now, don't get me wrong, I make exceptions to this when I have a client with certain tastes, but this is the style I will use when the client leaves it up to me.
First, if I can use small packages to achieve what I need, I'll definitely consider them. I'm not a big fan of big elaborate systems except things that are well established and which fit a need very well. For example, WordPress and phpBB are great fits on some projects -- no need to rewrite those unless something special comes up.
Now, if I need to build something custom, then I don't like spaghetti code, so I need a framework. I don't like the learning curve of other frameworks, and I have learned a few, but they are either too cumbersome, too slow, too inflexible, or just generally are a plain in the rear to use.
Therefore, we have to separate out the PHP from the MySQL from the XHTML, so here's how I do it.
First, I used to use Smarty, and will still use it if a client wants it. However, now that I know Smarty, I've realized that it's actually slower, as well as redundant to, just using XHTML files saved as PHP pages with inside. I stick these in a subfolder called templates and load them with require_once instead of $smarty->display.
Second, to handle the MySQL, I use either Outlet ORM with PDO or Propel ORM with PDO, depending on client need. And if I have something special, some special SQL besides this, I do a straight PDO call by using parameterized SQL stored in a central conf file. (BTW, my conf files are actually PHP class files with public variables.) Parameterized SQL means I have SQL statements with ^ caret symbols inside where variables would go, and I use a Pack() function that I created to insert the variables inside those places.
Third, to handle the PHP page logic, I don't use MVC. Instead, I use PHP pages for each individual need, and each PHP page is started with a commented template where I insert my PHP logic. I call these "PHP Logic Templates".
Fourth, instead of a "Model" from MVC, I use a classes subfolder with my object classes inside.
Fifth, I use Blueprint CSS on difficult CSS projects, but now I often may go straight CSS based on things I learned from Blueprint. It makes for cleaner code to go without Blueprint, but it's not always possible.
Sixth, I still use everything else such as ProperCase() function naming, $sAdaptedHungarian for my variable naming, initial curly braces { on the same line as the statement where they are used (not on a new line), and everything else you see in previous posts besides the stuff about the database logic, which has changed a great deal now.
Showing posts with label WordPress. Show all posts
Showing posts with label WordPress. Show all posts
Wednesday, July 9, 2008
Wednesday, June 11, 2008
Cool New Service -- CushyCMS

A PHP associate shared this with me. This was a really cool new product on the web. It's free unless you want to brand the editor as your own, and then it's $28/mo USD (June 2008 prices).
http://www.cushycms.com/
Basically it lets you take any PHP page that may contain HTML or XHTML content inside, or any XHTML or HTML page, any Javascript file -- basically any text file that has HTML or XHTML tags inside. Then, you can add some class attributes on some existing tags, or wrap something in a DIV or SPAN or other tag and add the class attribute. Once you add that in and connect it to this FREE service and give it your FTP username and password, you can then export an interface to your client that's easy to use so that they can publish content to their own sites.
Now, here's a few catches where some of your clients may not like this:
- If they are concerned about the FTP security. Although it encrypts the FTP information it stores in its database, it still could be a risk that a hacker could get this information and the way to unencrypt it.
- If the service becomes extremely popular, can it scale to handle the load?
- If the service runs out of cash and needs to start charging for stuff it gives away for free.
- If the service is down and you are powerless to get it operational again for your client.
- If your client wants excerpts for articles on their home page, and then the ability to create new article pages with a given page layout.
- If your client wants an article archive with links for Previous and Newer entries, or a calendar to pick articles on certain dates.
- If your client wants to be able to search for content based on title, author, categories or tags, or content.
- If your client wants to view an image gallery for his entire site and see which images were used where on the site.
- If you want paginated articles when they are too long.
- If your client wants the power to create new page tabs on the site and add that content.
And next to that, for ease of use, I recommend WordPress CMS, hands down.
TXP is great when you have a given XHTML template and you need to paste it on the site with not much fuss and then plug in CMS tags into it.
WordPress CMS is great when you don't have a given XHTML template and are willing to either purchase or download one from the web custom-made for WordPress, or to export the default one, edit it, and re-upload something geared just for WordPress CMS.
Subscribe to:
Posts (Atom)