I'm in the same position as you -- I wanted a PHP-based "content management system" that produces perfect XHTML, and since I wanted to understand it, know how it works and learn PHP in the process, I wanted to write it myself.
I quickly realized that that was totally impossible with my super-newbie skills, so I decided to cheat. 🙂
I browsed through hotscripts.com's PHP CMS section and downloaded a few scripts that promised the sort of functionality I wanted -- article categories, user comments, etc. -- and poked around at the code and stared at it until it made sense. After I found one with most of the stuff I wanted, I made sure the license agreement didn't prohibit modifying the code, and proceeded to EDIT THE FILES INTO SUBMISSION until the script did what I wanted.
I'm still working on the editing into submission part. 🙂 Eventually, I'll end up with someone else's script, modified to fit all of my needs, and I'll sort of feel like I had something to do with its creation and be happy I've learned something about PHP in the process. To give thanks for that, I'll link liberally to the original script's web site, noting that my site's powered by a customized version, and thank the original author for his or her work. Some authors like getting email to see where their script's being used; if your pet script's author says something along those lines, it'd probably be nice of you to email him or her also, with lots of thanks and maybe some notes on what you'd done.