===== 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 [[http://www.impresspages.org/docs2/core2/url-structure2/|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) \\ | {{http://i520.photobucket.com/albums/w327/schajtan/2013-02-24_23-46-08_zps8f18e122.png?400}} | Zones are listed in menu and can be filled by pages: \\ | {{http://i520.photobucket.com/albums/w327/schajtan/2013-02-24_23-53-08_zpsc06a11a2.png?400}} |{{ http://cdn.impresspages.org/image/impresspages_cms_zones_and_pages_2_1.png }} | ==== Plugins = Modules ==== Plugins alias Modules contribute functionality. [[http://www.impresspages.org/docs2/working-with-plugins2/custom-zone-example2/|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_DIR|http://zvgcms.nu/ip_libs/| |BASE_DIR|Z:/home/zvgcms.nu/www/| |BASE_DIR.LIBRARY_DIR|Z:/home/zvgcms.nu/www/ip_libs/| |BASE_DIR.MODULE_DIR|Z:/home/zvgcms.nu/www/ip_cms/modules/| |BASE_URL.PLUGIN_DIR|http://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 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 generateBlock('main'); ?> generateBlock('custom_block'); ?> //generate a link to a custom_zone generateUrl(null, 'custom_zone').'">AddressBook records'; ?> ===== 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); } }