Hello everyone,
I am developing a simple fan-based website for a videogame I have played for a few years now. At the moment, I am having an issue with the organization and design of the website due to the mass amount of content involved with this videogame. I would like for my website to be dynamically templated and to reuse the least amount of html/php/etc. tags as possible.
Initially, I started out using basic HTML and PHP5 include tags so that all I would have to do is add in the Table of Contents, Banner, and Footer tags to any given .php file (each .php had a different body). This became very tedious after having hundreds of .php files and needing to change every single tag in every single .php file, for example, when the location of the Table of Contents file changed. Another option I wanted to incorporate in my website was a dynamically changing banner (every refresh the banner would change from an array of banners), which would be impossible (in this sense) unless done manually. Also, since my website is hosted locally I was starting to see performance issues on every page load/reload when the browser would have to redundantly load the banner, Table of Contents, and footer, though, they were already previously loaded and unchanged from the prior page load.
The website layout is basic: Table of Contents ("ToC") is on the left, Title Banner is on the top, Footer is on the bottom, and Body resides in the middle right. My first attempt at this was through a suggestion of using Asynchronous JavaScript (AJAX). If you browse my website,
http://www.vyrsace.com , you will see that method in place. The effect is right, it loads the body dynamically but the problems I face are two:
1.) The address bar within the browser remains constant. This means, any user that browses my website and finds his/her way down to a deep sub-section/category cannot utilize their back/forward/bookmarking browser capabilities because the page address remains the same, regardless of the body's content, therefore, the page is treated as the same page (in this case, it would be the main page
http://www.vyrsace.com).
2.) Any AJAX script I use within the body malfunctions (AJAX within AJAX doesn't work? Or maybe I made an improper syntax reference?). If you would like to see what I mean by this you may browse
http://www.vyrsace.com and from the main page click on "The Absolute Plan" link on the Table of Contents (left side). This will load a little chart in the body area. Now click on any other link on the Table of Contents and then click "The Absolute Plan" link again, it will not load (Note: The "Loading..." notice was just a filler I created in case there was network lag and was actually waiting to load the body, so it's best to assume no actual function is activating).
In conclusion, I have used PHP5 include tags but want less code redundancy (use less needed tags) and the option to dynamically change my banner on refresh. I also have used AJAX but want to sustain the basic browser capabilities for user ease (Back, Forward, and Bookmarks) as well as dynamically update items within the body as well (not just dynamically update the body itself). I have heard MySQL in conjunction with PHP5 is a good path in doing this, but I am unable to find via Google or otherwise any tutorial that seems relevant to this.
As you can see, I am offering 500 points for this question due to the complex and specific nature (assumingly) of this situation. Any code, scripts, links, tutorials, examples, snippets, etc. are welcome. The reward will go to the most detailed correct/helpful answer. Thank You!
View the Solution FREE for 7 Days