Flat-file CMS for front-end developers
<TextField>
A flat-file CMS for front-end developers. Write your HTML, mark a few variables as editable, and <TextField> gives your client a dashboard for the rest. No database, no admin theme to learn.
<article>
<h2>{article_title}</h2>
{article_text}
</article>
<TextField> is different.
No database, no setup wizard. <TextField> stores everything in plain JSON files next to your theme, so installing it means copying a folder and nothing else.
You keep full control of the markup. Build your theme however you want, then mark a handful of variables as editable. Your client gets a dashboard for text, images and content blocks, without ever touching your code.
Have a look at the shortest documentation ever, and once you're done, <TextField> will become your best friend.
Installation
You've just downloaded the archive. Copy the TextField/ folder contents to your project root, and that's it, <TextField> is installed.
<TextField> stores its data in .json files and needs no database. It runs on PHP 8.4.
Create your theme in the themes/ folder and prefix your relative paths with the theme name in your HTML files. The root is set by the index.php file.
Open ./panel/ on your webserver. The first time, you'll be asked to choose an administrator password yourself, there's no default password to remember or change later.
Build the data tree
The data is divided in 2 types of elements:
- Static contents which are single fields. Example: the description of the website.
- Flows which are sets of items. Example: a portfolio. Items of a flow share the same fields.
It's suggested to create a .json file for each independent part of your website to avoid useless loads. Example: the portfolio and the about text are stored in home.json and the blog in blog.json.
Load your theme
Open index.php then change the load() .json data file path and the tpl::parse() .html template file path to match with yours. You can load or parse more than one file by duplicating the lines.
If you want to create a separate page, copy paste the index.php file in the same directory then edit the file name and the data and template files path.
From now on, links between pages must call .php root files.
Inject the data
In the panel, you have the matching variable name under each field and each flow. Call a simple variable to display its value: {about_text}. Use the following syntax for flows:
{item in $articles} <!-- "item" is a prefix to avoid conflicts and could be named as you want -->
<h2>{item_title}</h2>
{item_text}
{end}
To set a conditon, use this syntax:
{if /*PHP syntax here, you have access to all the variables*/}
<!-- content -->
{elseif /*PHP syntax*/}
<!-- content -->
{else}
<!-- content -->
{end}
Want to do more? <TextField> uses Templite engine, read its short documentation.
Extra contents
An automatic variable is set to each item of a flow, called $id. Its value is the specific zero-based number of the item.
Variables have not always simple text value. To help, some field types automatically create extra variables: date, image... Just open the source in your browser to see the available variables and their content at the end of it.
Sort and filter flow items
{prefix in sortFlow($flow, 'id')}...{end} sorts a flow by item $id ascendant.
{prefix in sortFlow($flow, 'id', true)}...{end} sorts a flow by item $id descendant.
{prefix in filterFlow($flow, fn($item) => $item['id'] <= 3)}...{end} selects the items which id is 3 or less. Use PHP syntax and the items variables to write conditions.
{prefix in sortFlow(filterFlow($flow, fn($item) => $item['id'] <= 3), 'id', true}...{end} both filters and sort matching items.Publish
First, freeze the data tree by turning off developer mode: open core/config.php and set 'devmode' to false.
Then comment out the tpl::fix() line in each PHP root file you've created, so visitors can't see the variables list.
Finally, set 'cache' to 1 in core/config.php to speed up your pages and avoid accidental edits from stray clicks in the panel. Click "Publish" in the panel each time you want the site to refresh.
Templite
Templite is a PHP template engine, designed to be as powerful as optimized, light and easy-to-use.
The amount of features makes it a real solution for your website: you would be able to separate data processing from displaying in the most comfortable way. It's only 4ko of pure cleverness created to enhance your productivity.
Any feature has been omitted from an usual template engine. That's the strength of Templite: you can do everything, with the best performance.
Soft syntax
The syntax has been made as instinctive as possible so you have both the best reading and writing comfort on your template files.
Infinite nested blocks
Create as many levels of blocks as you need and easily unfold them without any conflict thanks to custom prefixes.
Conditions
Variables are extracted in the template file, so it becomes easy to write conditions with a native PHP syntax in a custom syntax structure.
Functions and more
Native PHP is enabled in template files, so it's possible to apply functions to variables and manipulate them.
Translations
Translate some texts of your website using Templite custom language files. If a text hasn't a matching translation, it will be displayed unchanged.
Clever inclusions
Include template files straight from template files. Even include, a file will be compiled separately to be ready for a second call.
Best performances
Loaded in only 0.1ms, Templite compiles a strong template file in less than 5ms and displays it in some 10ms, without cache!
Complete global cache
Each page will be cached for each combination of superglobals values. You can also set custom parameters and an expiration time.
Clean code & paths
Unlike the majority of template engines, Templite provides a beautiful code and preserves your relative paths, based on the PHP calling file directory.
Debug
It becomes easy to fix a bug when you have a complete list of set variables and blocks, displayed in a comment in the source of your page.
Background dev mode
Templite will automatically overwrite the compilation file of an edited template or language file.
Light as a feather
All those stunning features fit in a 4ko script. Incredible, isn't it?
Buy <TextField> CMS
See License Agreement for full terms and conditions. For inquiries about licensing, billing
and secure payment processing, please, use support@textfield.org.
One time-payment, not a subscription.
Pro
€199 Inc. VAT
You are a team/developer and you create websites for your clients or you have a hosted web service with the subscription or Intranet site.
- Unlimited websites for your own clients & projects
- Unlimited developers, domains & sub-domains
- Full access to source code
- Free updates for current major version
- 50% discount for the next major version
- Technical support by email
- Not included: redistributing <TextField> as part of a product you sell — see OEM
OEM
€999 Inc. VAT
You sell or distribute software like Design template. And you deliver <TextField> along with your product code.
- Redistribution rights: bundle & ship <TextField> inside a product (theme, starter kit, platform) you sell or distribute
- Unlimited end-customers receiving your product
- Unlimited developers, domains & sub-domains
- Full access to source code
- Free updates for current major version
- 50% discount for the next major version
- Technical support by email
Safe and Secure payments are processed by Paypal.com.
We do not store or see your credit card data.