Sections

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
Tagged

One thought on “Sections

  1. [...] latest iteration runs on my Sections framework (gotta eat that dog food) and is based on the Foundation framework, which I have fallen [...]

What did you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.