Search:     Advanced search

A Quick Start Guide

Article ID: 78
Last updated: 13 Aug, 2011
Revision: 6
Print
Export to PDF
Email to friend
Views: 0

In this Quick Start Guide we are going to create a basic content page. This contentpage consists of a controller/action and a view.

First I recommend you to read the overview. This helps you to understand what we are doing here. Furthermore I recommend you to read the documents-page. This page explains you what we are doing here.

Together with this Quick Start Guide you should be able to understand Eicra documents in general.

The first few steps will be done directly in the code. Only for the last steps we are logging into the backend.

As mentioned already before, Eicra uses Zend_View as its template engine, and the standard template language is PHP.

The product implementation of Zend_View offers special methods to increase the usability:

Method

Description 
inc 
Use this function to directly include a document 
template 
Use this method to include a template 
cache 
In template caching 
translate 
i18n / translations 
glossary 
Glossary 

Some Examples

Method  Description 
action  http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.action
headMeta  http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.headmeta
headTitle  http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.headtitle
translate  http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.translate

There are some properties which are automatic available in the view:

You can use your own custom Zend_View helpers, or create some new one to make your life easier.

Name  Type  Description 
editmode  boolean  Is true if you are in editmode (admin), false if you are on the website
controller  Eicra_Controller_Action_Frontend  A reference to the controller
document  Document 

Editable (Placeholders for content)

Reference to the current document object you can directly access the properties of the document in the view (eg. $this?document?getTitle();)

We offer a basic set of placeholders which can be placed directly into the template. In editmode they appear as an editable widget, where you can put your content in. While in frontend-mode the content is directly embedded into the HTML.

There is a standard scheme for how to call the editables. The first argument is always the name of the element (as string), the second argument is an array with multiple options (configurations) in it.

Example

 <!-- creates a input in editmode (admin) and directly outputs the text in frontend -->
<h1><?= $this->input("headline", array("width" => 540)); ?></h1>

<!-- advances template -->
<?php $this->layout()->setLayout('standard'); ?>


<h1><?= $this->input("headline", array("width" => 540)); ?></h1>
<h1><?= $this->numeric("number", array("width" => 540)); ?></h1>

<?php while ($this->block("contentblock")->enumerate()) { ?>
    <?php if($this->editmode) { ?>
        <?= $this->select("blocktype",array(
            "store" => array(
                array("wysiwyg", "WYSIWYG"),
                array("contentimages", "WYSIWYG with images"),
                array("video", "Video")
            ),
            "onchange" => "editWindow.reload.bind(editWindow)"
        )); ?>
    <?php } ?>
    
    <?php if(!$this->select("blocktype")->isEmpty()) {
        $this->template("content/blocks/".$this->select("blocktype")->getData().".php");
    } ?>
<?php } ?>

This article was:  
Also read
document How to manage or customize State and Area.

Also listed in
folder Developer Documentation

Prev   Next
Customize the basic configuration though Global Setting.     Making a listing as featured and un-publish it as draft.