This commit is contained in:
Frank Nägler 2013-10-14 13:15:23 -07:00
commit 23abe7954f
4 changed files with 43 additions and 9 deletions

1
.gitignore vendored
View file

@ -17,6 +17,7 @@ Thumbs.db
# User themes
themes/*
!themes/index.html
!themes/default
!themes/default/*
# User config

View file

@ -3,6 +3,9 @@ Title: Welcome
Description: This description will go in the meta description tag
*/
{column:content}
## Welcome to Pico
Congratulations, you have successfully installed [Pico](http://pico.dev7studios.com). Pico is a stupidly simple, blazing fast, flat file CMS.
@ -10,9 +13,9 @@ Congratulations, you have successfully installed [Pico](http://pico.dev7studios.
### Creating Content
Pico is a flat file CMS, this means there is no administration backend and database to deal with. You simply create `.md` files in the "content"
folder and that becomes a page. For example, this file is called `index.md` and is shown as the main landing page.
folder and that becomes a page. For example, this file is called `index.md` and is shown as the main landing page.
If you create a folder within the content folder (e.g. `content/sub`) and put an `index.md` inside it, you can access that folder at the URL
If you create a folder within the content folder (e.g. `content/sub`) and put an `index.md` inside it, you can access that folder at the URL
`http://yousite.com/sub`. If you want another page within the sub folder, simply create a text file with the corresponding name (e.g. `content/sub/page.md`)
and you will be able to access it from the URL `http://yousite.com/sub/page`. Below we've shown some examples of content locations and their corresponing URL's:
@ -106,3 +109,9 @@ lists all of the settings and their defaults. To override a setting, simply unco
### Documentation
For more help have a look at the Pico documentation at [http://pico.dev7studios.com/docs](http://pico.dev7studios.com/docs)
{/column:content}
{column:sidebar}
sidebar content goes here
{/column:sidebar}

View file

@ -11,6 +11,7 @@ use \Michelf\MarkdownExtra;
*/
class Pico {
private $columns = array();
private $plugins;
/**
@ -22,7 +23,11 @@ class Pico {
// Load plugins
$this->load_plugins();
$this->run_hooks('plugins_loaded');
// Load the settings
$settings = $this->get_config();
$this->run_hooks('config_loaded', array(&$settings));
// Get request url and script url
$url = '';
$request_url = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : '';
@ -51,10 +56,6 @@ class Pico {
$this->run_hooks('after_404_load_content', array(&$file, &$content));
}
$this->run_hooks('after_load_content', array(&$file, &$content));
// Load the settings
$settings = $this->get_config();
$this->run_hooks('config_loaded', array(&$settings));
$meta = $this->read_file_meta($content);
$this->run_hooks('file_meta', array(&$meta));
@ -98,6 +99,9 @@ class Pico {
'next_page' => $next_page,
'is_front_page' => $url ? false : true,
);
foreach ($this->columns as $var => $code) {
$twig_vars["column_{$var}"] = $code;
}
$this->run_hooks('before_render', array(&$twig_vars, &$twig));
$output = $twig->render('index.html', $twig_vars);
$this->run_hooks('after_render', array(&$output));
@ -133,6 +137,17 @@ class Pico {
{
$content = preg_replace('#/\*.+?\*/#s', '', $content); // Remove comments and meta
$content = str_replace('%base_url%', $this->base_url(), $content);
// pattern to find {column:xyz} {/column:xyz} column marker
$pattern = '#({column:(.*?)})(.+?)({/column:\\2})#ims';
preg_match_all($pattern, $content, $matches);
$counter = 0;
foreach ($matches[2] as $var) {
$this->columns[$var] = MarkdownExtra::defaultTransform($matches[3][$counter]);
$counter++;
}
$content = MarkdownExtra::defaultTransform($content);
return $content;

View file

@ -29,9 +29,18 @@
</header>
<section id="content">
<div class="inner">
<!-- old {{ content }} variable works also -->
<!-- div class="inner">
{{ content }}
</div>
</div -->
<div class="inner">
<div class="col_content">
{{ column_content }}
</div>
<div class="col_sidebar">
{{ column_sidebar }}
</div>
</div>
</section>
<footer id="footer">