code-section

Jeem

Jeem is a tiny flat-file CMS written in PHP. No database to mess with, no admin interface, just files. Simply create a file for each page and that's it.

  Lightweight

Jeem is tiny and simple; in around 250 lines of php code, it is lightweight and fast! It will not read page files unless it needs to.

  Easy

Creating and editing pages is as a matter of creating and editing files. This page is all the documentation you will need!

  HTML Format

What you write is what you get. The HTML is the language of the web, and of Jeem pages as well.

  PHP Templates

PHP is a templating language in the first place, so why not put it to its intended use?

  Open Source

Jeem's source code is hosted on BitBucket for all to see and contribute.


Installing Jeem

Download Jeem and upload it to your server. Now you have a live website with sample pages!

Typically you will want to create and edit your website on your local machine and then upload it to your live server. You can use PHP's built-in server for development. An even lighter solution is to use Zach Saw's QuickPHP, a stand-alone php server in 3 megabytes.

Creating Pages

You will want to place your pages and assets in folders other than the included sample folders. Create a folder called pages in the root directory. This is where you will be creating and editing page files.

Each page is required to have a title or Jeem will ignore it. Here is the structure of a Jeem page file:

<?php
$page["title"] = "My Page Title";

// other page properties can be set here.
?>

<p>HTML page contents</p>

Naming Page Files

The name of the page file determines its "slug", or the link that can be used to access the page.

Pages are always ordered alphabetically in descending order. You can place an optional prefex followed by a dot before the slug in the page or folder file name. The prefix is not included in the slug but is only used for ordering pages. For example, for a blog, you can write your posts with the format yyyymmdd.blog-post-slug.php and the blog posts will be ordered newest-to-oldest automatically.

Page File Page Link
index.php site-name.com
my-page.php site-name.com/?page=my-page
01.my-page.php site-name.com/?page=my-page
news/index.php site-name.com/?page=news
news/20180701.migrated-to-jeem.php site-name.com/?page=news/migrated-to-jeem
news/archive/20170201.old-news.php site-name.com/?page=news/archive/old-news

Jeem Values

Inside your page, you can insert a jeem value from the "Name" column inside double curly braces {{ }} without spaces and Jeem will substitute it with the actual value.

Example: {{page.title}} is replaced with "Jeem"

NameValue
page.titleJeem
page.pathnamepages/jeem/index.php
page.slugjeem
page.url?page=jeem
page.dirpages/jeem
page.themecode-section
pages-dirpages
themes-dirthemes
BASE_URLhttp://code-section.com/
BASE_PAGE_URLhttp://code-section.com/?page=

Assets

You can create a folder to contain your images and other resource files in the root directory. For example, if the folder is called "assets", you can reference asset files like so: <img src="{{BASE_URL}}/assets/cute-cat.jpg">

Jeem does not process assets or read any directories other than the "pages" directory.

Internal Page Links

To create a link to some page on your website while keeping the website "portable", you can use the BASE_PAGE_URL Jeem value: <a href="{{BASE_PAGE_URL}}slug-of-page">Link Text</a>. Use BAGE_URL to link to the homepage: <a href="{{BASE_URL}}">Homepage</a>.

Clean URLs

Optionally, you can enable clean urls in Jeem using the included .htaccess files for apache servers. This will allow you to access pages without the "?page=" part of the regular URL.

If you are using the built-in PHP server, you can enable clean URLs by passing "routing.php" as a command line argument to the server. For example:

php.exe -S localhost:5566 routing.php

Other Resources