FEAST CMS | Documentation

# FEAST CMS Documentation Current version 2.5

## Introduction

FEAST CMS is a PHP content management system built on codeIgniter framework with fully functionality and customizable. with FEAST CMS you can manage your website whatever you activity with our awesome functions and features, you also can create your own theme with the possibility of custom options system with one line of code. you can check all our features by clicking this link Check all features

### Todo list:

- Widets system
- Modules system
- Menu manager
- Visual editor
- More free themes
- and more

## ScreenShoots

#### Dashboard

#### Menu Manager

#### Module system

#### Themes page

#### Theme options

#### Create slider

## Folder structure

    File Hierarchy of the Source Code Package

    Feast-CMS/
    │
    ├── documentation/
    │
    ├── feast-content/
    │   │
    │   ├── language/
    │   │
    │   ├── modules/
    │   │
    │   ├── themes/
    │   │
    │   ├── thumbs/
    │   │
    │   ├── uploads/
    │   │
    │   └── users/
    │
    ├── feast-includes/
    │   │
    │   ├── admin/
    │   │
    │   ├── application/
    │   │
    │   └── system/
    │
    ├── install/
    │
    └── index.php

## Installation

How to install Feast CMS on your host.

1. Extract `FeastCMS.zip`.
2. Upload all files and folders from feast-cms directory to your website.
3. Create a new MySql database and a user for it.
4. Using your browser to visit this link `http://your-website/install.` or `http://your-website/folder/install.`
5. Folow the installation wizard to finish the installation.

## Features

check what FeastCMS can do for your work.

- Themes system
- Custom options
- Menu manager New
- Module system New
- Visual editor New
- Sliders system
- Media manager
- Language system
- Custom functions

## Themes system

We worked hard to make our system able to adapt to the activity of your website whatever, and our template system was one of the most important things we have to provide in our system to be able to customize it to maximum degree.

#### Tip!

jQuery and bootstrap JS files must place on `<heade>` tag.

    Theme file structure

    your-theme/
    │
    ├── layouts/
    │   │
    │   ├── includes/
    │   │
    │   ├── main.php
    │   │
    ├── theme_options/
    │   │
    │   ├── functions.php (this file contains the custom options functions)
    │   │
    │   └── index.php (this file contains the view of theme custom panel in dashboard)
    │
    ├── category.php
    │
    ├── index.php
    │
    ├── page.php
    │
    ├── posts.php
    │
    ├── screenshot.png
    │
    ├── single.php
    │
    └── style.css (* required file - this file contains the theme information)

#### Note:

if any of not required files are not found in your theme, the requested file will be automatically including from the default theme.

#### Style.css file example

    /**
    * Theme Name: Default Theme
    * Theme URI: http://demo.eadhassan.com/feast-cms
    * Version: 1.0
    * Description: Default theme for FEAST CMS
    * Author: Ead Hassan
    * Author URI: http://eadhassan.com
    */

## Custom options

with our custom option feature you can create a fully customizable themes with theme panel on dashboard to customize your own theme options.

#### How to use custom options

you have to create to files on your theme in `theme_options` directory
first file named `functions.php` and second file named `index.php`

There is two three functions for this feature :

### Explain is_option() function

Function: is_option( `$option = ''` )
Parameters | `$option` : string
Return | TRUE if is there an option with the given name, FALSE if not
Return type | bool

### Explain add_option() function

Function: add_option( `$option = ''`, `$value = ''` )
Parameters | `$option` : string, `$value` : string
Return | UPDATE if option already exists, INSERT if not exist
Return type | bool

### Explain get_option() function

Function: get_option( `$option = ''` )
Parameters | `$option` : string
Return | the option value that stored in from database
Return type | mixed

#### Usage example

##### functions.php file

    <?php
    function options()
    {
        if(is_option('OPTION_NAME') == FALSE){add_option('OPTION_NAME', 'DEFAULT_VALUE');}

        if(is_option('OPTION_NAME') == FALSE){add_option('OPTION_NAME', 'DEFAULT_VALUE');}

        if(is_option('OPTION_NAME') == FALSE){add_option('OPTION_NAME', 'DEFAULT_VALUE');}
    }

    options();
    ?>

##### index.php file

    <!--
      Demo text input
      ** please check functions section to learn more about this function
    -->
    <div class="col-xs-12">
      <?=admin_input_text(
        'Posts per page', // input label
        'posts_per_page', // input name
        get_option('posts_per_page'), // input value
        'Set number of posts per page.' // help text
      )?>
    </div>

##### This code will return something like this

## Sliders

most websites have one or more sliders and certainly it would be nice to have easy control over creating or modifying, so we make our sliders system friendly and easy to use with many options and wonderful features

ScreenShoots:

#### Latest posts

#### Custom slider

#### Slider types :

### Custom posts : Return an array of selected posts as slides

- Select posts
- Post picture as background
- Static background

### Custom categories : Return an array of posts as slides

- Post categories
- Post num - number of posts
- Post picture as background
- Static background

### Latest posts : Return an array of latest posts as slides

- Post num - number of posts
- Post picture as background
- Static background
- expect posts
- expect categories

### Custom slider : Return an array of your slides

- slide title - for each slide
- slide description - for each slide
- slide background - for each slide
- slide button text - for each slide
- slide button link - for each slide
- slide button target - for each slide

## Media manager

with our media manager you can upload, rename or delete media files (images, videos and more), and when you add new post or page you can select post image from media manager easy

ScreenShoots:

#### Select post image

## Menu manager

One of the best new features on v2.0 is Menu manager so you can now create multiple menus and manage items using drag and drop nesting. and for use any of this items just use the only function below on any place in your theme files.

ScreenShoots:

#### Menu manager

## Module system

This new feature helps you integrate a small project with the system without having to modify the basic system files, all you need is your knowledge of the CodeIgniter framework . And will be developed in the coming period to compensate for its codes to be able to deal with it fully without the need for any knowledge of the CodeIgniter framework .

I working now on some tutorials to show you how to create basic and advanced module with custom options and settings.

ScreenShoots:

#### Module system

## Visual editor

This feature is the most powerful in v2.0 where you can create shortcuts for each element of your template so that it can be inserted into the page with one click.

I working now on some tutorials to show you how to create a custom shortcode for using on visual editor. And will be developed in the coming period to have more customization like drag and drop elements ...

ScreenShoots:

#### Visual editor

## Languages

#### Tips:

When you create a new language the system will automatically create a new fields on database for post/page title and body and will add a new tab on post/page add or edit page it will be something like this :

Also when the user change website language the system will look for the post title and body for current language and if it not set the system will return the default language title and body

#### Post translation

#### Be Happy:

For more customizable you can create a custom languages phrases for doing this please follow the steps below

First step: in `feast-content` directory create a `language` directory if not exist.

Second step: in `language` directory create a folder for each language you want to translate with the same name of language.

Third step: in each language directory create a file named `lang.php` and add your custom phrases as shown below.

    <?php

    $lang['key'] = 'value';
    $lang['key'] = 'value %s' (%s will replaced with the second parameter in feast_line() function if exist);
    $lang['key'] = 'value';
    $lang['key'] = 'value';

    ?>

and to call a language phrase just echo this function in any place `feast_line( $key, $optional );`.

## Functions

### User functions

Function: is_logged_in()
Return | TRUE if user logged in, FALSE if not
Return type | bool

Function: is_admin()
Return | TRUE if current session is admin, FALSE if not
Return type | bool

Function: get_user( `$field = ''`, `$id = ''`)
Parameters | `$field (string)` : field name `$id (int - optional)` : user id
Accepted keys | (username, email, fullname, firstname, lastname, dateofbirth, gender, country and picture)
Return | The field value for current user if second parameter is not set
Return type | string

#### Usage example

    <?php

    /*
     * check if is current user
     * is logged in and is admin
     */

    if( is_logged_in() && is_admin() ) {

      // echo username is admin
      echo get_user('username') . ' is Admin';

    } else {

      // echo username is user
      echo get_user('username') . ' is a user';

    } else {

      // if no logged in
      echo 'Not logged in';

    }

    ?>

### Post functions

#### Note:

All post functions are work for post or page with the same parameters.

Function: post_title( `$post = array()` )
Parameters | `$post (array)` : the post array
Return | post title for current language session
Return type | string

Function: list_posts( `$limit = null`, `$offset = 0`, `$category = null`)
Parameters | `$limit (int - optional)` : number of posts `$offset (int - optional)` : number of offset id`s `$category (int - optional)` : category id to get posts from
Return | array of posts with given options
Return type | array

Function: post_body( `$post = array()` )
Parameters | `$post (array)` : the post array
Return | post body for current language session
Return type | string

Function: post_excerpt( `$post = array()`, `$chars = null`, `$words = null`)
Parameters | `$post (array)` : the post array `$chars (int - optional)` : number of characters to limit `$chars (int - optional)` : number of words to limit
Return | post body for current language session with limitation
Return type | string

Function: post_image( `$post = array()` )
Parameters | `$post (array)` : the post array
Return | post image URL in full width
Return type | string

Function: post_thumb( `$post = array()`, `$size = null` )
Parameters | `$post (array)` : the post array `$size (string)` : 'small', 'medium', 'wide' or 'large'
Return | post thumbnail URL in given size or default thumbnail size
Return type | string

Function: post_url( `$post = array()` )
Parameters | `$ (array)` : the post array
Return | post or page full URL
Return type | string

Function: post_date( `$post = array()`, `$nice = FALSE` )
Parameters | `$post (array)` : the post array `$nice (bool)` : TRUE : FALSE
Return | post date in nice formate if second parameter is TRUE, full date if FALSE
Return type | date

Function: post_author( `$post = array()` )
Parameters | `$post (array)` : the post array
Return | post author
Return type | string

Function: post_category( `$post = array()` )
Parameters | `$post (array)` : the post array
Return | post category
Return type | string

Function: post_cat_url( `$post = array()` )
Parameters | `$post (array)` : the post array
Return | post category URI
Return type | string

Function: post_option( `$option`, `$post = array()` )
Parameters | `$option (string)` : your custom post option `$post (array)` : the post array
Return | the given post option
Return type | mixed

Function: comment_box( `$id` )
Parameters | `$id (int)` : current post or page id
Return | a working comment box with Ajax call
Return type | HTML

Function: show_comments()
Return | list comments for current post or page with Ajax
Return type | HTML

Demo code for post functions

    <?php

    /*
     * in this demo we will list a posts throw a foreach loop
     * and we will echo post title and post excerpt (limited to 15 words)
     * see a code below
     */

      foreach( list_posts() as $post ):

        echo '<h3>' . post_title( $post ) . '<h3>';
        echo '<p>' . post_excerpt( $post, 15 ) . '<p>';

      endforeach;

      // this code will return something like
      // <h3>Post title</h3>
      // <p>Post excerpt<p>

    ?>

### Slider functions

Function: slide_title( `$slide = array()` )
Parameters | `$slide (array)` : the slide array
Return | Title of current slide
Return type | string

Function: slide_text( `$slide = array()`, `$limit = optional` )
Parameters | `$slide (array)` : the slide array `$limit (int - optional)` : limit a number of words
Return | text of current slide
Return type | string

Function: slide_background( `$slide = array()` )
Parameters | `$slide (array)` : the slide array
Return | background URL of current slide
Return type | string

Function: slide_button( `$slide = array()` )
Parameters | `$slide (array)` : the slide array
Return | button URL of current slide
Return type | string

Function: slide_button_text( `$slide = array()` )
Parameters | `$slide (array)` : the slide array
Return | button text of current slide
Return type | string

Function: slide_button_target( `$slide = array()` )
Parameters | `$slide (array)` : the slide array
Return | button target URL of current slide
Return type | string

### Category functions

Function: list_cats()
Return | array of categories
Return type | array

Function: cat_title( `$cat = array()` )
Parameters | `$cat (array)` : the category array
Return | Category title
Return type | string

Function: cat_url( `$cat = array()` )
Parameters | `$cat (array)` : the category array
Return | Category full URL
Return type | string

### Custom options functions

Function: admin_input_text( `$label = ''`, `$name = ''`, `$value = ''`, `$help = FALSE` )
Parameters | `$label (string)` : input label `$name (string)` : input name `$value (string)` : input value `$help (string - optional)` : help text shown under the input label
Return | bootstrap `.form-group` class with label and text input
Return type | HTML

Function: admin_input_spinner( `$label = ''`, `$name = ''`, `$value = ''`, `$help = FALSE` )
Parameters | `$label (string)` : input label `$name (string)` : input name `$value (string)` : input value `$help (string - optional)` : help text shown under the input label
Return | bootstrap `.form-group` class with label and text input
Return type | HTML

Function: admin_textarea( `$label = ''`, `$name = ''`, `$value = ''`, `$help = FALSE` )
Parameters | `$label (string)` : textarea label `$name (string)` : textarea name `$value (string)` : textarea value `$help (string - optional)` : help text shown under the textarea label
Return | bootstrap `.form-group` class with label and textarea
Return type | HTML

Function: admin_radio( `$label = ''`, `$name = ''`, `$value = ''`, `$help = FALSE` )
Parameters | `$label (string)` : label label `$name (string)` : label name `$value (string)` : label value `$help (string - optional)` : help text shown under the label label
Return | bootstrap `.form-group` class with label and a beautiful radio buttons
Return type | HTML

Function: admin_radio_image( `$label = ''`, `$name = ''`, `$options = array()`, `$value = ''`, `$help = FALSE` )
Parameters | `$label (string)` : label label `$name (string)` : label name `$options (array)` : array of options something like this `array('http://placehold.it/250x80', 'http://placehold.it/250x80')` `$value (string)` : label value `$help (string - optional)` : help text shown under the label label
Return | bootstrap `.form-group` class with label and an awesome radio images
Return type | HTML

Function: admin_select( `$label = ''`, `$name = ''`, `$options = array()`, `$value = ''`, `$help = FALSE` )
Parameters | `$label (string)` : select label `$name (string)` : select name `$options (array)` : array of options something like this `array('Enable' => 'true', 'Disable' => 'false')` `$value (string)` : select value `$help (string - optional)` : help text shown under the select label
Return | bootstrap `.form-group` class with label and an awesome radio images
Return type | HTML

Function: admin_upload( `$label = ''`, `$name = ''`, `$value = ''`, `$help = FALSE` )
Parameters | `$label (string)` : select label `$name (string)` : select name `$value (string)` : option value `$help (string - optional)` : help text shown under the input label
Return | bootstrap `.form-group` class with label and an file input using media manager
Return type | HTML

Demo code for custom options functions

    <?php

    /*
     * this code from the default theme in our system
     *
     */

      $themes = array(
                  'default' => 'default',
                  'cerulean' => 'cerulean',
                  'cosmo' => 'cosmo',
                  'cyborg' => 'cyborg',
                  'darkly' => 'darkly',
                  'flatly' => 'flatly',
                  'journal' => 'journal',
                  'lumen' => 'lumen',
                  'paper' => 'paper',
                  'readable' => 'readable',
                  'sandstone' => 'sandstone',
                  'simplex' => 'simplex',
                  'slate' => 'slate',
                  'solar' => 'solar',
                  'spacelab' => 'spacelab',
                  'superhero' => 'superhero',
                  'united' => 'united',
                  'yeti' => 'yeti'
              );

      $types = array(
                  1 =>  THEME_FOLDER.'assets/images/slider/Slide-01.png',
                  2 =>  THEME_FOLDER.'assets/images/slider/Slide-02.png',
                  3 =>  THEME_FOLDER.'assets/images/slider/Slide-03.png'
              );

      $layouts = array(
                  1 =>  THEME_FOLDER.'assets/images/blog/1cols.png',
                  2 =>  THEME_FOLDER.'assets/images/blog/2cols.png',
                  3 =>  THEME_FOLDER.'assets/images/blog/3cols.png'
              );
    ?>

          <div class="col-xs-12">
            <?=admin_select('Home slider', 'home_slider', sliders_list(), get_option('home_slider'), 'Select a slider for home page.')?>
          </div>

          <div class="col-xs-12">
            <?=admin_radio_image ('Slider type', 'slider_type', $types, get_option('slider_type'), 'Select a slider type.')?>
          </div>

          <div class="col-xs-12">
            <?=admin_radio_image ('Post layout', 'posts_layout', $layouts, get_option('posts_layout'), 'Select a post layout.')?>
          </div>

          <div class="col-xs-12">
            <?=admin_select('Bootstrap Theme', 'bootstrap_theme', $themes, get_option('bootstrap_theme'), 'Select a bootstrap theme.')?>
          </div>

          <div class="col-xs-12">
            <?=admin_radio('Post comments', 'post_comments', get_option('post_comments'), 'Enable/Disable post comments.')?>
          </div>

          <div class="col-xs-12">
            <?=admin_radio('Page comments', 'page_comments', get_option('page_comments'), 'Enable/Disable page comments.')?>
          </div>

          <div class="col-xs-12">
            <?=admin_input_spinner('Posts per page', 'posts_per_page', get_option('posts_per_page'), 'Set number of posts per page.')?>
          </div>

          <div class="col-xs-12">
            <?=admin_input_spinner('Home page posts', 'home_posts_num', get_option('home_posts_num'), 'Set number of posts on home page.')?>
          </div>

    ?>

This code will return this page :

#### Theme options panel