code-section

Jeem

Jeem is a tiny flat-file CMS written in PHP. No database to mess with, no admin interface, no Markdown, twigs, plugins, or anything fancy. 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 text 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 the extracted files 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 XAMP or 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";
?>
<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. The format is optional_prefix.page-slug.php.

Pages are always ordered alphabetically in descending order. You can use the optional prefix to specify the order of pages without affecting page links, since the prefix is not included in the page link. 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.

The folder structure in the "pages" folder is reflected in the page links. Consider this table:

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

Inside the "pages" folder, if a subfolder does not contain an index file, it is ignored.

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 for the page you are reading now.

NameValue
{{page.title}}Jeem
{{page.pathname}}pages/jeem/index.php
{{page.slug}}jeem
{{page.url}}http://code-section.com/jeem
{{page.dir}}pages/jeem
{{page.theme}}code-section
{{pages-dir}}pages
{{themes-dir}}themes
{{BASE_URL}}http://code-section.com/
{{BASE_PAGE_URL}}http://code-section.com/
{{JEEM_CLEAN_URLS}}1

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 code portable, you can use the BASE_PAGE_URL Jeem value:

<a href="{{BASE_PAGE_URL}}slug-of-page">Link Text</a>

Use BASE_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