Pretty URLs are a staple of modern web development and I wanted a way to implement them without having to work inside of a framework which may come with a ton of unnecessary files. The end result is a “framework” of sorts which looks in a directory of files and folders for a file path matching the URL.
Example
example.com/first/second/third will be interpreted to either:
- first/second/third.php
- first/second.php with the parameter “third”
- first.php with the parameters “second” and “third”
The framework is incredibly simple to use, just include the Sections.php file in your code and call Sections::load() to load the current section. I mostly use it for small pages where a CMS would be overkill or when I’m prototyping something that has multiple pages. The code is available on GitHub and the design document is available for download.
Source on GitHub | Design Document
Advertisement
[...] latest iteration runs on my Sections framework (gotta eat that dog food) and is based on the Foundation framework, which I have fallen [...]