Table of Contents

Imresspages CMS

A nice looking drag and drop CMS: https://www.impresspages.org/

Fallpits

Issue Answer
Howto choose the first zone? The top zone, listed in the Backend> Developer > Zones is considered used for the frontpage
Error Solution
Class 'Modules\zvg\zvgtable_zone\Zone' not found in Z:\home\zvgcms.nu\www\ip_cms\frontend\site.php(387) : eval()'d code on line 1 The Namespace may be wrong: namespace Modules\zvg\zvgtable_zone

Concepts

Zone

Zones are reflected in the URL

http://www.example.com/language/zone/page/sub-page/


Many zones may occur on one page: e.g. Searchzone, Menuezone
A zone is filled by a module (plugin)

Zones are listed in menu and can be filled by pages:

Plugins = Modules

Plugins alias Modules contribute functionality. To zones, to backend..

Global Variables

The full list can be found in file “ROOT\www\ip_config.php”

VAR RESULT
BASE_URL http://zvgcms.nu/
BASE_URL.THEME_DIR http://zvgcms.nu/ip_themes/
BASE_URL.THEME_DIR.THEME http://zvgcms.nu/ip_themes/zvg
BASE_URL.LIBRARY_DIRhttp://zvgcms.nu/ip_libs/
BASE_DIRZ:/home/zvgcms.nu/www/
BASE_DIR.LIBRARY_DIRZ:/home/zvgcms.nu/www/ip_libs/
BASE_DIR.MODULE_DIRZ:/home/zvgcms.nu/www/ip_cms/modules/
BASE_URL.PLUGIN_DIRhttp://zvgcms.nu/ip_plugins/

Plugin

Step Howto Link
0. Create a Template Create a template with for the new zone, add a custom block where the plugin content will be presented, by doing
<?php echo $this->generateBlock('side'); ?>

. Look in \ip_themes\ for example templates.

http://www.impresspages.org/docs/getting-started/understanding-themes/
1. Write Plugin with an own zone http://www.impresspages.org/docs/working-with-plugins/custom-zone-example/
2. Install the new Module. Click on “Install” in Backend> Developer> Modules.
3. Create a Zone in BE. Create a Zone in the Backend> Developer> Zones. Associate the zone with your template and plugin(alias module)http://www.impresspages.org/docs/working-with-plugins/custom-zone-example/
4. Populate the block from point 0. with content Create a System File in your plugin folder to populate your Block you generated in 0. with content. You can add some JavaScript / CSS to the page too by doing
$site->addCSS(BASE_URL.PLUGIN_DIR.'examples/random_sentence/public/randomSentence.css');
$site->addJavascript(BASE_URL.PLUGIN_DIR.'examples/random_sentence/public/randomSentence.js');
http://www.impresspages.org/docs2/core2/blocks/

Commands

 //generate a named block
 <?php echo $this->generateBlock('main'); ?>
 <?php echo $this->generateBlock('custom_block'); ?>

  //generate a link to a custom_zone
  <?php echo '<a href="'.$site->generateUrl(null, 'custom_zone').'">AddressBook records</a>'; ?>

Ajax

Add Javascript

Add the m g a vars (http://www.impresspages.org/docs2/core2/mvc-model-view-controller2/) To point to the right controler.

//in system import the *.js
// 2 is the internal import priority. Default is 1. Makes script be imported after all other, like jquery. 
$site->addJavascript(BASE_URL.PLUGIN_DIR.'zvg/zvgtable_zone/js/jstest.js', 2);	

$(document).ready(function() {
  console.log("request per ajax now!");
  showRandomSentence();
});


//post request to our plugin to get new sentence
function showRandomSentence() {
    var data = Object();
    data.g = 'zvg'; //our module group
    data.m = 'zvgtable_zone'; //our module name
    data.a = 'getNewSentence'; //action (method) that need to be executed on the server


    $.ajax( {
    type : 'POST',
    url : ip.baseUrl, //ip.baseUrl is a root of your website available globaly in JavaScript
    data : data,
    success : sentenceResponse,
    dataType : 'json'
    });    
}

function sentenceResponse(response) {
	
	console.log("Receive data:");
	console.log(response);
}

Add php in sentenceResponse.php

class Controller extends \Ip\Controller{
    public static function getNewSentence() {
        global $site;
        $data = array(
            'status' => 'success',
            'sentenceHtml' => "hellow from controler"
        );
        
        $answer = json_encode($data);
        $site->setOutput($answer);
    }

}