vB style url's/navbar, how ?
View Single Post
12-31-2009, 07:20 AM
Join Date: Feb 2007
I have done this using numerous methods. The most simple for me was to simply define or in the case of a forum, create a friendly url value out of the title. In my CMS' I do the same only the administrator can define one, if not defined, create from the title.
Either way, my current CMS is MVC based, so it has been quite simple to do. For example, site.com/content/index/php would really be a call to the content.php controller, calling the index() method and passing php as a parameter.
I would then show the page that matches php as the URL value (ofcoarse upon creating, editing, etc pages I ensure I can't have conflicting results, many of the same, etc). Further more I can go another step to have site.com/content/index/php/strlen.
This is the same, but php AND strlen is passed to the index() method. If I find I have the second parameter, I will attempt to load the child based on the parent being PHP.
I know, sounds confusing but its not. You could do similar things using $_GET alone, but you will need more mod_rewrite rules to match. For example, in an older CMS I wrote before finding MVC, I used to have a component based setup. Basically, I requested an action ( $_GET['action'] ) which was used to determine the component file. If the action was content, then I would load content.php.
From here the component decided what to do, usually in the constructor or a secondary method (using switch to check for a $_GET['whatever_else']). Using that value would determine the method called, and for additional parameters I would simply call $_GET again. MVC made this MUCH, MUCH easier (you can check out Kohana Framework, Code Ignitor or MVC design patterns with PHP).
In your case, or in VB, I don't know how they do it. I've made a forum in which you would have urls such as site.com/forum/general/how-do-i-do-this.html. Again, the same principal. general is a value stored in the database under a URL field. how-do-i-do-this is a value stored in the database as well, but the topics have a forum_url field to match to ensure that the how-do-i-do-this page belongs with general.
Sorry, might sound confusing, but it's not that bad if you play with it. If you need, I can show off my database schema for the CMS/forum I am writing and it will probably click much better.
View Public Profile
Send a private message to Killswitch
Find More Posts by Killswitch