From e23e61daad5cafa49213c7d2ab4cd8825e2dbb52 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Sat, 1 Aug 2015 21:55:19 +0200 Subject: [PATCH 1/4] CONTENT_DIR constant isn't functional anymore --- index.php | 1 - 1 file changed, 1 deletion(-) diff --git a/index.php b/index.php index d18b4c2..cb98acf 100644 --- a/index.php +++ b/index.php @@ -1,7 +1,6 @@ Date: Sat, 1 Aug 2015 22:03:54 +0200 Subject: [PATCH 2/4] Move config.php to config/; Add CONFIG_DIR and VENDOR_DIR constants --- config.php.template | 54 --------------------------------------------- index.php | 7 ++++-- lib/pico.php | 8 +++++-- 3 files changed, 11 insertions(+), 58 deletions(-) delete mode 100644 config.php.template diff --git a/config.php.template b/config.php.template deleted file mode 100644 index c0195ee..0000000 --- a/config.php.template +++ /dev/null @@ -1,54 +0,0 @@ - false, // To enable Twig caching change this to CACHE_DIR -// 'autoescape' => false, // Autoescape Twig vars -// 'debug' => false // Enable Twig debug -// ); - -/* - * CONTENT - */ -// $config['date_format'] = '%D %T'; // Set the PHP date format as described here: http://php.net/manual/en/function.strftime.php -// $config['pages_order_by'] = 'alpha'; // Order pages by "alpha" or "date" -// $config['pages_order'] = 'asc'; // Order pages "asc" or "desc" -// $config['excerpt_length'] = 50; // The pages excerpt length (in words) -// $config['content_dir'] = 'content-sample/'; // Content directory - -/* - * TIMEZONE - */ -// date_default_timezone_set('UTC'); // Timezone may be reqired by your php install - -/* - * CUSTOM - */ -// $config['custom_setting'] = 'Hello'; // Can be accessed by {{ config.custom_setting }} in a theme - -// Keep this line -return $config; \ No newline at end of file diff --git a/index.php b/index.php index cb98acf..b69d4ac 100644 --- a/index.php +++ b/index.php @@ -1,12 +1,15 @@ config = @include_once(ROOT_DIR . 'config.php'); + if (file_exists(CONFIG_DIR . 'config.php')) { + $this->config = require(CONFIG_DIR . 'config.php'); + } else if (file_exists(ROOT_DIR . 'config.php')) { + // deprecated + $this->config = require(ROOT_DIR . 'config.php'); + } $defaults = array( 'site_title' => 'Pico', From 6e8bc85a8b5fa707941de5414a2981321409e182 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Sat, 1 Aug 2015 22:07:14 +0200 Subject: [PATCH 3/4] Move config.php.template to config/; Add config/.gitignore --- config/config.php.template | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 config/config.php.template diff --git a/config/config.php.template b/config/config.php.template new file mode 100644 index 0000000..c0195ee --- /dev/null +++ b/config/config.php.template @@ -0,0 +1,54 @@ + false, // To enable Twig caching change this to CACHE_DIR +// 'autoescape' => false, // Autoescape Twig vars +// 'debug' => false // Enable Twig debug +// ); + +/* + * CONTENT + */ +// $config['date_format'] = '%D %T'; // Set the PHP date format as described here: http://php.net/manual/en/function.strftime.php +// $config['pages_order_by'] = 'alpha'; // Order pages by "alpha" or "date" +// $config['pages_order'] = 'asc'; // Order pages "asc" or "desc" +// $config['excerpt_length'] = 50; // The pages excerpt length (in words) +// $config['content_dir'] = 'content-sample/'; // Content directory + +/* + * TIMEZONE + */ +// date_default_timezone_set('UTC'); // Timezone may be reqired by your php install + +/* + * CUSTOM + */ +// $config['custom_setting'] = 'Hello'; // Can be accessed by {{ config.custom_setting }} in a theme + +// Keep this line +return $config; \ No newline at end of file From f90e3b447297425eab58e9fdd8e7ce52a1222d58 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Sat, 1 Aug 2015 22:38:14 +0200 Subject: [PATCH 4/4] Update inline doc --- config/config.php.template | 6 +++--- content-sample/index.md | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/config/config.php.template b/config/config.php.template index c0195ee..5d186b1 100644 --- a/config/config.php.template +++ b/config/config.php.template @@ -11,8 +11,8 @@ * @license http://opensource.org/licenses/MIT * @version 0.9 * - * To override any of the default settings below, uncomment the line, - * make and save the changes, then rename this file to `config.php` + * To override any of the default settings below, copy this file to + * `config.php`, uncomment the line and make and save your changes. */ /* @@ -51,4 +51,4 @@ // $config['custom_setting'] = 'Hello'; // Can be accessed by {{ config.custom_setting }} in a theme // Keep this line -return $config; \ No newline at end of file +return $config; diff --git a/content-sample/index.md b/content-sample/index.md index 7c258ea..8ebddac 100644 --- a/content-sample/index.md +++ b/content-sample/index.md @@ -55,16 +55,16 @@ There are also certain variables that you can use in your text files: You can create themes for your Pico installation in the "themes" folder. Check out the default theme for an example of a theme. Pico uses [Twig](http://twig.sensiolabs.org/documentation) for it's templating engine. You can select your theme by setting the `$config['theme']` variable -in config.php to your theme folder. +in `config/config.php` to your theme folder. All themes must include an `index.html` file to define the HTML structure of the theme. Below are the Twig variables that are available to use in your theme: -* `{{ config }}` - Conatins the values you set in config.php (e.g. `{{ config.theme }}` = "default") +* `{{ config }}` - Conatins the values you set in `config/config.php` (e.g. `{{ config.theme }}` = "default") * `{{ base_dir }}` - The path to your Pico root directory * `{{ base_url }}` - The URL to your Pico site * `{{ theme_dir }}` - The path to the Pico active theme directory * `{{ theme_url }}` - The URL to the Pico active theme directory -* `{{ site_title }}` - Shortcut to the site title (defined in config.php) +* `{{ site_title }}` - Shortcut to the site title (defined in `config/config.php`) * `{{ meta }}` - Contains the meta values from the current page * `{{ meta.title }}` * `{{ meta.description }}` @@ -100,8 +100,9 @@ See [http://pico.dev7studios.com/plugins](http://picocms.org/plugins) ### Config -You can override the default Pico settings (and add your own custom settings) by editing config.php in the root Pico directory. The config.php file -lists all of the settings and their defaults. To override a setting, simply uncomment it in config.php and set your custom value. +You can override the default Pico settings (and add your own custom settings) by editing `config/config.php` in the Pico directory. +The `config/config.php.template` lists all of the settings and their defaults. To override a setting simply copy +`config/config.php.template` to `config/config.php`, uncomment the setting and set your custom value. ### Documentation