Coa, a GetSimple framework
Coa is a powerful framework to create lean and functional templates.
It provides CoaScript and some useful out of the box features for fast and flexible development.
Coa is available for GetSimple, the simplest Content Management System ever.
The latest version is Coa 1.11.
Download |
Manual |
GitHub |
Support |
Donate
Features
- CoaScript
- Hierachical, Breadcrumb and extended Menus
- Smooth Page Translation
- E-Mail Protection
- Additional Page Content
- Tags and Variables
- Fullscreen Theme Edit
- Optional Admin Style
Install
- Upload "CoaPlugin" and "CoaPlugin.php" to your plugins folder
- Upload "CoaTheme" to your theme folder
- Activate both theme and plugin
- Reload the front-end
License
MIT License
Copyright (c) 2013 Benjamin Scherer
Feel free to contact me if you have any further questions.
b@plue.me
1. CoaScript
A website developed with Coa needs at least two templates: constant.coa.php
and page.coa.php
.
The constant template contains the website header and a bit of configuration, the page template contains the website body.
Create objects like menu
, css
, content
or image
to build your template.
Assign attributes to them to specify their behaviour. You find all objects and attributes in the reference below.
You can use variables like $excerpt
, $description
or $title
to print the data you need.
Page template example:
menu
act = <li class="active"> | </li>
content
wrap = <main><h1>$title</h1> | </main>
text
value = <footer>this is the footer</footer>
if = sub
Rules
- Objects have to be separated with an empty line. Even the last one!
- Use
#
at the beginning of a line to comment attributes or even whole objects.
- Coa templates may use ".coa", ".coa.php" or ".coa.txt".
- Paths usually start in the theme folder.
- Wraps are always separated with a pipe, e.g.
<b>|</b>
1.1 Examples
Create a dynamic breadcrumb navigation:
menu
mode = breadcrumb
cur = <li id="cur"> | </li>
Show the component "sidebar" on the homepage:
content
get = sidebar
only = index
Place other files into your template:
place
file = footer.php
wrap = <footer> | </footer>
Use the constant template to include CSS and JavaScript files:
css
all = css/style.css
print = css/print.css
script
js = js/jquery.js
js1 = js/functions.js
Protect email links and strings:
config
protMail = 2
1.2 Conditions
Show or Hide on Page(s)
All objects can have the attributes only
and exclude
.
Both can have comma separated page ids where to show or hide the object:
meta
description = This is the website description ...
only = index, about-us
#exclude = index
Show or Hide on Subpages and Translated Pages
All objects can use if
with the values sub
or !sub
to show or hide it on subpages:
text
value = <h1>$title</h1>
if = !sub
and the values translation
or !translation
to show or hide it for a certain language:
text
value = <h1 class="french">$title</h1>
if = translation
Condition for Back-End Login
You can use login
or !login
for logged in (or not logged in) back-end users:
text
value = still in production...
if = login
1.3 Constant Objects
config
loginReq = if set to 1, login is required to see the website
minify = if set to 1, source code is compressed
htmlTag = enter custom string, e.g. <html id="foo">
bodyTag = use "basic" or "extended" for IE and no_js classes or enter custom string
extFiles = set to "none" to exclude external files (e.g. lightbox CSS)
protMail = 1 protects email strings (use %m@d.com%), 2 also protects mailto links
wrapPage = wraps the whole page template, e.g. <div id="wrap"> | </div>
main
title = defines the website <title> tag
charset = website charset, default is utf-8
language = set language code for <html> tag (comma separated for translation)
base = set to "none" to exclude base tag (can lead to unexpected behavior)
meta
viewport = defines the content of the viewport <meta> tag
robots = defines the content of the robots <meta> tag
description = website meta description
keywords = website meta keywords
headerGS = set this to "none" to exclude the default GetSimple header
css
wrap = wraps each <link> tag, e.g. for conditional comments
all = path to css file without media attribute, also numeric (all1 - all9)
screen = path to css file with media="screen", also numeric (screen1 - screen9)
print = path to css file with media="print", also numeric (print1 - print9)
handheld = path to css file with media="handheld", also numeric (handheld1 - handheld9)
script
wrap = wraps each <script> tag, e.g. for conditional comments
js = path to JavaScript file, also numeric (js1 - js9)
text
value = string to echo into the website header
wrap = wraps the whole object
place
file = path to file that shall be included (php, html, txt or coa file)
wrap = wraps the whole object
1.4 Page Objects
text
value = string to echo
wrap = wraps the whole object, e.g. <p> | </p>
link = define a link, optional target set after comma
class = set class for link (string, variable or mixed)
content
get = get components or pages ("page: page_slug") instead of regular page content
wrap = wraps the whole object, e.g. <article> | </article>
image
file = path to the image
alt = alternative title
title = image title
wrap = wraps the whole object
size = define image width and height, separate with comma ("auto" for no attribute)
link = define a link, optional target set after comma
menu
mode = use "breadcrumb" or "default" (native GetSimple menu)
list = comma separated page ids, if set only these pages are shown
language = comma separated menu texts for language menu (active if set)
tree = creates a menu from subpages of given page id
extended = adds content and date if set "true", crop content with setting a number
title = use 1 to show the title attribute of the <a> tags
wrap = wraps the whole menu, default is <ul> | </ul>
item = wraps each menu item, default is <li> | </li>
act = wraps each active menu item, means current page and its parents
cur = wraps the current menu item, e.g. <li id="cur"> | </li>
place
file = path to file that shall be included (php, html, txt or coa file)
wrap = wraps the whole object
script
js = path to JavaScript file to fire in the footer, also numeric (js1 - js9)
wrap = wraps the <script> tag, e.g. for conditional comments
2. Tags
2.1 Image Tags
These tags basically fetch images from a given directory. Display them as thumbnails, an image list or in a minimalist lightbox. Image captions, titles and alternatives are fetched from the file title. Paths always start at "data/uploads/".
Lightbox
- Use
[lightbox: path_to_folder]
to insert the Coa Lightbox.
- Depends on jQuery and an automatically included lightbox script. (Deactivate external files with
extFiles
)
Images
- Use
[images: path_to_folder]
to insert an image list.
Thumbnails
- Use
[thumbs: path_to_folder]
to insert a thumbnail list.
2.2 Page Tag
Insert the page content of a given slug into another page.
3. Variables
There a several variables available you can use universally.
$title
-> echo page title
$cleanTitle
-> echo unformatted page title
$slug
-> echo page slug
$keywords
-> echo page meta keywords
$description
-> echo page meta description
$date / $date(Y)
-> echo page date (last change) with optional format in brackets, default is "j. M Y"
$excerpt / $excerpt(100)
-> echo content excerpt with optional length in brackets, default is 100
$parent
-> echo page parent
$siteName
-> echo website name
$theme
-> echo theme name
4. Page Translation
With a click on "Translate Page" in the sidebar of Pages you can easily translate the page title, menu text and content of every page. All Coa Objects can be visible or invisible for a certain language. See Conditions for details.
Example language menu:
menu
language = English, German
act = <li class="act"> | </li>
Set the <html> tag language codes:
main
language = en, de
Settings
You may hide the "Translate Page" button via "Coa Settings" (Settings page).
With the constant TRANSLATIONURL
in "CoaTheme/config.inc.php" you can set the translated language name for the language parameter.
If your website is in a subdirectory you need to set the constant SUBDIRPATH
in "CoaTheme/config.inc.php" and update the RewriteBase
in your ".htaccess" file as well.
5. Change Log
Version 1.11
- New menu option "tree" and "extended"
- New translation uri for flexible url rewrite
- Bugfix in language detection
- HTML Cache is now deprecated
- Renamed folders in "CoaPlugin"
- Improved content markup and templates
- Optimized "loginReq" for renaming admin folder
Version 1.10
- New: Translatable additional content
- Simplified usage of multiple page templates
- Fixed lost custom editor toolbars
- Moved Coa settings to Settings page
- Fixed XML error in CoaSettings.xml
- New: Attribute to exclude base tag
- Optimized lightbox
Version 1.9
- Moved scripts to footer template
- Added local jQuery fallback
- Fixed missing link type in additional content editors
- Improved JavaScript for additional content editors
- Updated jQuery and crack.css
Version 1.8.1
- New class for content wrap (if there's additional content)
- Bugfix lightbox (IE only)
- Updated CRACK CSS
Version 1.8
- New attribute "class" for text object
- Links in menus have classes now
- Consistent image order (Image Tags)
- Storing cache files in "data/other/coa"
- Solved a lot of PHP notices
- Improved placing files
Version 1.7.1
Version 1.7
- Additional page content
- Login condition
- Coa Settings on Plugins page
- New Tag: Get page content with [page:slug]
- Bugfix: Image Tags HTML structure
- Optional admin style
- "place" into Constant template, too
Version 1.6
- Fullscreen and responsive theme edit
- Default suffix ".php" for Coa templates
- External file for lightbox CSS
- New config attribute "extFiles"
- Bugfix: Caching translated pages in a subdirectory
- Less CSS, no more layout
Version 1.5.2
- Bugfix: Saving quotes in page translations
Version 1.5.1
- Bugfix: Including Coa files with "place"
Version 1.5
- Page Translation
- Rearranged Coa to a plugin
- Language menu
- Conditions for page language
- Improved caching
- List and Breadcrumb menus show pages not added to menu
- Lightbox bugfix and relocated script to "plugins/CoaPlugin/res/"
- Removed webfont "Dosis"
Version 1.4
- Global variables to echo data
- Removed attribute "data" and the "%"-variables
- Removed attribute "favicon", "base" and value "ieClass"
- New attribute "bodyTag"
- Responsive CSS
- Lightbox script moved to Google Code
- Default charset is utf-8
- Renamed menu mode breadcrump to "breadcrumb"
- Menu <a> tags have no title by default
- Place object supports txt files
- Less code, less bugs
Version 1.3
- Menu from list
- Improved documentation
- Minimalist design
- Get content of certain page
- Media "handheld" for CSS object
Version 1.2
- Coa Lightbox
- Images and thumbnails from directory
Version 1.1
- Custom HTML tag
- Optional template suffix .coa.php
- Reset and base CSS
Version 1.0
- Coa template language
- HTML cache
- Source compression
- Hierarchical menus
- Breadcrumb navigation
- Active and current menu items
- Protection of email links and strings
- HTML5 ready