Login

Designing Code

An insider's view into the dark world of marketing and how to design code with the right side of your brain.

Refactoring

I've been looking into what paths to take to refactor my communityCMS from procedural to OOP.  I'm setting up the code base to be below the web root as well as the uploads folder (having the file uploads below the web root plugs a common security hole).  This comes from reading the PHP In Action book. I'm finding that, while there are some new and strange (to me) concepts, OOP is quite doable and very interesting. The more I read, the more I want to tinker and build!

I'm building a basic DB connection class that will enable you to use the same class with different Database engines (MySQL, Postgres, MSSQL). Of course, this is standard on alot of modern systems, but it's new in my system, which has mysql calls hard coded in.

Th uploads folder being moved to below the web root will mean some changes to the current upload function (thank God I thought to make it a centrally located function!), but I thought it was time to update the WYSIWYG editor. I'm moving from Innova Studio (http://www.innovastudio.com/editor.asp) to tinyMCE. The downside is that, while the editor is free, the uploaded media center isn't. Seeing as I'm a cheap bastard and I love to build apps, I'm building a media manager to plug into it.

I'm finding that code writing is alot like home remodeling- when you think it's going to take a couple of hours, count on 3 weeks!

Posted by kcbruce at 2009-03-05 1:27pm | Permanent Link | Comments(1)

old->new site mapping

Two years ago while working at Sea Grant, Dan and I were creating the new mdsg site. Sea Grant had hundreds of pages of existing content in static html. The main concern was that many in the community had bookmarked alot of the content and when we launched the new site, those bookmarks would generate 404's (a very unhelpful content dead end).

Since we were porting the exact same content into a database served by a PHP CMS, we devised a fairly elegant (by "elegant", I mean simple) solution.

At launch time, we moved the old site to a hidden URL as a reference. This was so the script that we'd create could reference the old site, parse the title, search the current db of titles and return a list of suggested pages they were looking for. When a person chose the correct page, it would map that choice to the requested url and learn what page went where. The next time a person hit that link, the error page would forward them to the mapped page.

Of course, we knew that this kind of relied on the person choosing the correct link in the first place, but it was close enough for government work (being an educational institution) and the site had a search feature to help them should they be lead astray.

Click to see Code

 

Posted by kcbruce at 2009-03-02 2:10pm | Permanent Link | Comments(0)

GEEK GEEK GEEK!

Oh, how I envy the attendees of the PHPUK conference! All day today, there's been geek chatter on Twitter from the attendees. For those of us that wear multiple hats and duties at work, such a narrowly focused conference is out of the question. Hell, in these times it would be, even if my job was pure PHP!

Most people hate going to trade shows and conferences, but for me- I love them! It's a chance to see what others in your industry are doing. A chance to meet other fellow PHP geeks, compare geek notes and carry on geeky conversations that would make a mear mortal's eyes roll back in their heads before collapsing in a paralytic state of boredom! Those same conversations are electric for coders. To discuss the myrid ways to come to a solution through simple lines of text!

You will never see such a display of geeky gadgetry as at a tech conference, and not on display by the vendors- but being carried around by the attendees. iPhones, Blackberries, netbooks and the latest laptops- not to mention a few prototypes! Don't be fooled by the outer casings though- that MacBook Pro is running CentOS and that Acer netbook is running Ubuntu- Now that's cool!

I hope to go to another conference soon, but til then I get to hear the lucky bastards that are actually at one now...

BTW- Whoever took the "PHP Women's" elePHPant, please return it! Not cool!

Posted by kcbruce at 2009-03-02 10:43am | Permanent Link | Comments(0)

Share |

Home  • NeutralGood Blog  • Tech Blog  • Portfolio  • Resume  • Scripts  • Photos  • Contact
Phone: (240) 415-8721
http://www.kevinbruce.com · Site Modified Mar 15, 2013 · ©2013 Kevin Bruce | Designer of Web & Print
Follow me on LinkedIn Profile   Facebook   Twitter