This is a simple pretty URL module for Core Boxx. That is, turning an ugly URL like
TABLE OF CONTENTS
|Download & Notes||Quick Reference|
DOWNLOAD & NOTES
First, here are the download links and a quick “setup guide” for the impatient folks who don’t have the patience to read through everything.
Core Boxx is released under the MIT License. You are free to use it for your own personal and commercial projects, modify it as you see fit. On the condition that there the software is provided “as-is”. There are no warranties provided and “no strings attached”. Code Boxx and the authors are not liable for any claims, damages, or liabilities.
INSTALLATION & REQUIREMENTS
- Download and set up the “main Core Boxx” if you have not already done so.
- Apache URL rewrite module must be enabled.
- Take note, this module will override the
index.phpfile and introduce a new
This section is a quick walkthrough of the general module structures.
REAL QUICK WALKTHROUGH
- There are no library files in this module, only
- How it works is simple – Generate a
.htaccessfile that redirects all URLs to
index.php. Less the existing files and folders.
- So in
index.php, we can do our own custom URL handling. The default mechanism is kept as simple as possible, it will look for corresponding files in the
- For example,
http://site.com/hello/world/will “translate” into
- Feel free to modify as you see fit – Load contents from the database, create your own HTML template, use your own favorite client-side frameworks.
I WANT TO LOAD CONTENT FROM THE DATABASE
Yes, it is possible to turn this into a “content management system” like WordPress or Drupal.
- Create your own content module, or modify it from the content module.
- Introduce a new contents database table.
content_slugText, primary key.
content_titleTitle of page.
content_textThe main page content.
index.phpto load from the database instead.
$slug = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
$content = $_CORE->Content->get($slug);
- Show page if contents are found, 404 if not.