When it comes to side projects I often look for projects that will teach me something, why should my profile be any different?
To that end I wanted to play around more with CSS3 and shirk off the limitations I experiance in my day to day life, namely Internet Explorer. I have been creating the layout in Firefox, with an eye on Chrome. IE is an after thought, and will look quite a bit different from other browsers due it's lack of support. I suppose a fun challenge when all is said and done will be to get IE to look as close as possible. If you are not familiar with CSS and want to know the benefits of an all CSS layout vs using image files for a demonstration on what a simple modification to a textual css file can do.
I wanted the theme to be self contained and separate from content and functionality. So I created a theme folder with sub-folders for css, js, and images. I have a template file for the header, body, rightbar, menu, and footer. Each containing just the html and php code required to render their specific part of the page. At the root I have an index.php that ties all the individual parts together. Making it fairly simple to find the specific aspect of the website I need to edit and change it without digging through a lot of code.
External CSS is used instead of inline css, each page that requires it's own personal css markup has it's own file to keep things organized. I use DIV tags instead of TABLE tags allowing for easy restructuring of the layout, as demonstrated earlier by the button which calls some jQuery that toggles the css declarations applied to each element.Frame Work
I wanted it to be easy to add new content to the site as well. Basically I just wanted to be able to create a new file, add a link to the menu tree, and be done.
I created a class that gets called by the index file to fetch the guts of my pages. It does this based on the current path. I didn't want/need database driven Wysywig editors for adding and managing my content. I just wanted to be able to FTP in, create/edit files as needed and link them up. I also wanted to be able to just make the page in html using php as needed without having to wrap it in functions or classes or any extra garbage. So in my class I manipulate the output buffers to include the files I need and serve up the processed results.
Another handy part of sectioning off the parts of the websites (such as header,body,footer) is that I can actually generate the header last. That way all of the other sections have a chance to add CSS and JS to the header before the page is output to the browser.
I am also using the rewrite engine in .htaccess to clean up the urls.
In order to generate random quotes, I did need to hook up to a Database. PHPMyadmin is a great tool for managing the DB so I didn't need to reinvent the wheel on that. As for going in and getting my quotes, I built a class that handles all of the Database connections and functions. It also has the added benefit of making it easier, should I ever decide to change the type of Database that I use, to make that change. I made methods like 'fetch_array' that take in the result the same as mysql_fetch_array does and then just runs mysql_fetch_array and returns the result. The benefit is now if I want to change database types I just change this method, and not all of my mysql_fetch_array calls throughout the code. Once again keeping the management of my site simple and straight forward.
This is just a quick update, I am still working on the framework and the layout. As I add new things I will update this write up.