363
Table of Content Ionize 0.9.9 - User Guide Table of Content Basic infos Server Requirements License Agreement Change Log Credits Installation Downloading Ionize Installation Instructions Troubleshooting Migration from 0.9.x to 0.9.9 Development vs. Production Introduction Ionize at a Glance Main Concepts Main Ionize folders Quickstart : Ionize in 4 steps 1

Table of Content Ionize

Embed Size (px)

DESCRIPTION

manual

Citation preview

Table of Content

Table of Content

Ionize 0.9.9 - User Guide

Table of ContentBasic infos

Server Requirements License Agreement Change Log CreditsInstallation

Downloading Ionize Installation Instructions Troubleshooting Migration from 0.9.x to 0.9.9 Development vs. ProductionIntroduction

Ionize at a Glance Main Concepts Main Ionize folders Quickstart : Ionize in 4 stepsUsing Ionize & Editing Content

Discover the Ionize backend Languages Menus Pages Articles Media : Files, pictures, videos... Static translations Users and Groups Content Online / OfflineBuild the website

Create the theme Create one page : Views Articles and Types Add PHP to viewsTags reference

Introduction to Tags Common Tags Special Tags Shared attributes Website Navigation Languages Page Articles Medias Pagination Categories Archives User Form Extend Field Content Element Conditions with tagsExtend Ionize : Add your own data

Introduction Extend Fields Content ElementsTutorials

User registration, login and profile Build one module : Part 1 Build one module : Part 2 Build one module : Part 3 Build one module : Part 4Additional Resources

Community Forum Ionize on GitHubServer Requirements

ServerTop of PageIonize has the following server requirements :

Apache server,

PHP 5.2.6

MySQL 5.1

.htaccess fileTop of PageYou should be able to edit one customized .htaccess file :

RewriteEngine On

# The RewriteBase / instruction is commented. Remove the "#" to uncomment

# RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond $1 !^(index.php|robots.txt)

RewriteRule ^(.*)$ index.php/$1

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(application|modules|plugins|system|themes) index.php/$1 [L]

Change Log

Version 0.9.9Top of PageRelease Date: December 29, 2012

One big step for Ionize.

Complete rewrite of frontend tags : Basis stays the same, but the tags are more logical

"Form" and "User" tags replaces the modules Simpleform and Usermanager

Backend enhancements

Version 0.9.8Top of PageRelease date : Never released, internal use only.

This release was one intermediate step for Ionize.

Features :

Pages "full" URLs : URLs uses the complete nested path of pages

Standardization of backend panels

Version 0.9.7Top of PageRelease Date: September 2, 2011

Focus on tinyMCE integration

Upgrade of the backend to CodeIgniter 2 and mootools 1.3.1

Better module management

New Filemanager

Content Elements : Developpers can create their own complex data

Module : Simpleform, to create forms

Module : Usermanager, to manage advanced user's features : login, logout, profile

Version 0.9.6Top of PageRelease Date: November 28, 2010SVN Revision:

Features

Articles can be linked to more than one page. Each article can have its own type and view, depending on the parent page.

CKEditor and KCFinder are available as replacement for tinyMCE / tinyBrowser.

Articles "Drag'n'Drop" ordering directly in the tree.

No tree refreshing after articles ordering in one page.

Page and Article editing more visual.

Page and Article creation more logical.

Article and page "tab" memory. When editing an article or page in one language, navigation to another item opens the same tab.

More tooltips in admin panel.

Static translations rewritten. The editor can add his own terms.

Views and tags

become more simple and more flexible. The output HTML is managed by a helper.

Extend fields now outputs the default value if the default value is set.

If no view are defined for page and articles in the theme, Ionize now uses the default one from /application/views/default/

filters more consistent : "OR" filter correction for

Bugs correction

Corrected removing of an external link in a Page or Article.

Articles and page internal link correction.

Connect lib group ID retrieve bug corrected.

Downloading Ionize

Zip fileTop of Page Ionize 0.9.9 (Current version) Ionize 0.9.7Ionize on GitHub

The Ionize project sources are hosted on Github : http://www.github.com/ionize/ionizeAdministration panelTop of PageThe request URL /your-domain.tld/admin was not found on this server.

Check that the .htaccess file is present at the root of your installation.If not, rename the .htaccess.txt file to .htaccess.

The request URL /index.php/en/admin/user/login was not found on this server.

Edit the .htaccess file and add or remove the comment before the RewriteBase / instruction.

RewriteEngine On

# The RewriteBase / instruction is commented. Remove the "#" to uncomment

# RewriteBase /

RewriteCond $1 !^(index.php|themes|install|files|modules|robots.txt)

RewriteRule ^(.*)$ index.php/$1 [L]

Settings saving errors, no thumbnail creation...

Context: When you save settings or add some media to a content, an error message appears.

Solution: The server PHP user must have writing privileges on following folders and files:

/application/config/*

/themes/*

/files/*

/cache/*

Log on your server with SSH and execute the following commands :

chmod -R 0777 //application/config/

chmod -R 0777 //themes/

chmod -R 0777 //files/

chmod -R 0777 //cache/

"No input file specified"

Some server needs this specific configuration.Modify the .htaccess line to add a ? after the index.php :

RewriteRule ^(.*)$ index.php?/$1 [L] Cannot login to backofficeTop of PageIf you're not able to log to the backoffice (to the administration part of your Ionize site), check if the time of your server and the time on your local computer are set correctly.

Admin password lostTop of PageMake a copy of the /install folder on your website and go to :

http://your_domain.tld/install/?step=user

(see forum thread : http://www.ionizecms.com/forum/viewtopic.php?id=323)

Enabling logsTop of PageIf something weird is happening with Ionize, you may want to activate logs to be able to find where the problem is coming from.

Edit your /application/config/config.php file and set

$config['log_threshold'] = 4;

By default log file will be created in /system/logs/ folder.

InstallationTop of PageWe consider you're doing these steps first locally, to be sure everything works fine before uploading your new version on your server.

From the existing 0.9.x :1. Get and temporary store the encryption key from /application/config.php : $config['encryption_key']

2. Save the existing database

3. Get your theme folder

In the folder containing Ionize 0.9.9 :1. Edit /application/config.php and paste your encryption key

2. Copy your theme folder into /themes/3. Launch the installer

After installation :1. Delete all the /files/thumb_x folders : The new media tag doesn't need them

2. In Ionize, set the theme to your theme in Settings > Theme > Options3. Adapt your views

Development tipsTop of PagePage views vs. articles views

In older version of Ionize, articles have views and render itself : the tag was using the view as defined in the Ionize backend in Page Edition > Options > Articles list and Article views.

We strongly recommend to not use articles views anymore.Use only page views.The reasons are not technical :

Based on experience, building a website with page and articles views make edition more complicated for users,

Also, the developer who maintains the website has to manage a lot of articles views

In the fact, often articles views aren't necessary.

Page views : Articles list & Single article view

Pages have 2 kind of views, which can be defined in Options > Attributes > View and Options > Attributes > Single Article View :

If only the View if defined, the frontend will use this view in any situation.

If both View and Single Article View are set, the frontend will :

display the view defined in View when the URL asks for a page

display the view defined in Single Article View when the URL asks for one article

This behaviour makes the development of pages like blogs very easy.

TagsTop of PageThey are some changes concerning tags.These changes were necessary to make the tags more logical and more simple to use.

Before :

1

2

3

Now:

1

2

3

If you don't want to use one helper, simply remove the "helper" attribute.

Before :

1

Now :

1

This tag should be used inside one parent tag, which tells the from which page it has to get the articles.

To loop in a collection of elements, the use of the plural (collection) and the singular tag is mandatory. That means all tags which loops through a collection of elements have single elemnt tag which gives access to the element data.

Before :

1

2

3

Now :

1

2

3

4

5

To get the articles from a given page.

Before :

1

2

3

Now :

1

2

3

The use of the tag to render one article view is not recommended anymore.

In other words, prefer the use of page views only in Ionize, instead of use page AND article views.

Before :

1

2

3

4

Now :

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

If you need for to render each article with its own view : - Set the article view in Ionize- use inside the tag.

The single tag must be used when looping through media.

For picture, there is no need to define thumbs sizes in Ionize. Telling the tag the wished size will create the resized picture.

Before :

1

2

3

Now :

1

2

3

This tag never exists anymore. It is replaced by Before :

1

Now :

1

Categories list :Before :

1

2

3

Now :

1

2

3

Content Element for more details

Conditions in viewsTop of PageBefore 0.9.9, creating conditions in views was mostly done with pure PHP.

Now, 2 tags are available for conditions : and The tags are detailled in Tag Reference > Shared attributes.

Before :

1

2

3

4

5

6

7 Themes panel and save.

Start editing the views files in the /themes/my_theme/views folder of your theme.

Important: The 3 folders config, helpers, views must be present in your theme folder.No spaces or special chars are allowed in the folder name.

2. Create one page viewTop of PageIn the folder /themes/my_theme/views/ :Create the file called "my_page.php" and add the following code :

// This will display the current page title

// Here, we will loops through the articles of the current page

// Displays the article title

// Displays the article content

3. Activate the view in IonizeTop of PageA view can be used in 3 ways :

For pages

For articles

As partial in another view.

Page and articles views must be activated so Ionize can add them to the "view" list in the page and article panels.

In Ionize, go to : Settings > Themes...This panel shows the views PHP files. For each view, you can enter a logical name, which will be in the view list of the page edition panel, and set the type ("article" or "page").

4. Link the view to your contentTop of PageFirst of all create a page in Ionize, then select your view in the view list.

Once your views are activated, they will be available for editors who will create and edit the content with Ionize.

Next step ?Top of PageAdd data to your page views : Have a look at the Tag Reference section of this documentation.

Discover the Ionize backend

The Ionize backend, or "Administration panel" consists of:

The structure panel on the left

The main panel on the right

The main menu

The structure panel is always displayed and show you the pages and articles of the website. From this panel, you can order pages and article and move articles directly by drag'n'drop in the tree.

The main panel displays the content you're editing. It can be one page, one article, or any other panel.

The main menu give you access to your website settings, tools, modules and advanced content editing tools.

Previous Topic : Quickstart : Ionize in 4 steps Top of Page User Guide Home Previous Topic : Quickstart : Ionize in 4 stepsLanguages

During installation, you choose one default language for the website.

If you want to change it or if you want to add another language, go to Settings > Languages...To change the lang code and name, simply edit them.

Adding one language will add the corresponding language tab in all contents (pages, articles, etc.)

Menus

Menus organize the content : They are containers for pages.

2 menus can't be changed : "Main menu" and "System menu".The "Main menu" is the basic menu if you only have one menu in your website.The "System menu" contains system pages, like the 404 page.

Adding one menu

Go into the panel : Content > Manage menus...Click on the button : Create menuDisplay one menu

To display the pages of one menu in views, Ionize comes with 2 tags :

: This tag provides a one level navigation.

: Displays the complete tree of pages.

  • Home
  • Services
  • About us
  • Home
  • Services
    • Webdesign
    • Coding
  • About us

Look at the Ionize navigation tag documentation to see complete features of these tags.

Pages

Quick articles links

Creating one page - Pages settings - One page as a link - Page fields - Display page in viewsPages organize the content. They are used to build the navigation.

Pages can be nested, to create a multi-level navigation.

Pages are also containers used to display content (articles) or simply links to internal content or external URLs.

One page can only have one parent menu.

Creating one pageTop of PageTo create one page, you can :

Click on the Add Page icon on the right of the menu name OR

In the main menu, select Content > Create page...The options of the page aren't available when creating one page. They will be available once the page is saved.

Pages settingsTop of PageA page can be totally offline or online, or only online for a defined language. In this case, the page must be globally online and offline for the wished language.

One page as a linkTop of PageA page can link to an URL.

For example, a navigation item can link to an external URL or to an other internal page. Because pages are navigation items, simply add a link to a page to activate this behavior.

To create one link to another page in the website :

First save you new page, to display the right option column,

Then drag the pointed page from the structure tree to the link area of the source page.

If one page is a link to an URL (internal or external), the content of this page will never be displayed.Clicking on its link in the website navigation menu will point to the given link.

To create one link to an external URL :

Write the complete URL in the link area of the page. Example : "http://partikule.net"

Click on "Add link"

Page fieldsTop of PageHere is a description of the default fields of pages.

These fields can be set through the Ionize page edition panel and through the page options panel.

Main fields

FieldCan be translatedDescription

TitleYesPage's title

SubtitleYesPage's subtitle

URLYesPage's website URL.Must be unique on the whole website.

Navigation titleYesTitle of the page in the website's navigation menu.

Windows titleYesBrowser's window title. Useful for SEO.

Options : Attributes

FieldCan be translatedDefaultDescription

Display in navNoCheckedIf unchecked, this page will not be displayed in the navigation menu.The page URL will be reachable, even it is not in the navigation menu.

Has URLNoCheckedIf unchecked, this page will not be in the URL.

For example with the page : Company / Services / Customer Help

If the page "Services" has the checkbox "Has URL" unchecked, the URL of the page "Customer Help" will be :http://domain.tld/company/customer-help

If the page "Services" has the checkbox "Has URL" checked, the URL of the page "Customer Help" will be :http://domain.tld/company/services/customer-helpIf the page has no URL, it can't be called and will return one 404

ViewNocore/pageDefine the view to use for this page.If not set, Ionize will:

First look for one view called page.php in the website theme folder

Use the default view in : /application/views/core/page.php

Single article viewNoDefine the page view to use to display one single article.

Articles viewNoIf set, define which view will be used by articles showed by this page when more than one article is displayed.

Options : Parent

Changing the menu and/or page of one page will move the page to the selected menu / page.

FieldDescription

MenuSelect box of the available website's menus

PageSelect box of the available website's pages

Options : Dates

FieldDescription

DateLogical date of the page. Will replace the creation date when using the date tag.

PublishDate from when the page will be published

UnpublishDate from when the page will be unpublished.

Options : Sub navigation

Not documented at the moment.This feature needs to be confirmed.

Options : Advanced options

FieldDefaultDescription

HomeUncheckedIf checked, this page will become the home page of the website.

Used by moduleUnckeckedIf checked, sub URL of this page coming from modules will not return one 404

Article / Page0Pagination : Number of articles to display per page.0 means display all articles.

Options : SEO

FieldCan be translatedDescription

Sitemap priorityNoSitemap priority of this page. 5 is the defualt value.

DescriptionYesMeta description for this page. Will replace the website's default meta description.

KeywordsYesMeta keywords for this page. Will replace the website's default meta keywords

Options : Access authorization

FieldDescription

GroupGroup from whom the access is allowed. Each group with one level equal or greather than the selected group will have access to the page.

Options : Operations

FieldDescription

Copy contentCopy the content of the page from one language to another.

Include articlesIf checked, the copy operation will also copy the content of the articles linked to the page

Reorder articlesReorder the articles of this page by date (descendant or ascendant)

Display page in viewsTop of PageHere is one example on how to display page's data in views.

For a complete page tag documentation, see Page tag documentation.

Articles

Quick articles links

Create one article - Articles and parents pages - Article types - One article as link - Articles fields - Display articles in viewsArticles contains the textual content.

One article can be a :

A simple article

One blog post with publication dates

One images gallery,

Any other content... depending on the way it will be used and displayed in the view.

Parent pages

One article can have one or more parent page. That means it can be linked to more than one page.

One common usage is to be able to add one article from one internal page to one slider of the home page. This could be done automatically, but sometimes, the editor wants to have the flexibility to add choosen articles.

One article can also be orphan, without any parent. In this case, it can't be displayed but is editable through the Ionize Dashboard "Orphan articles" list

Main parent

If one article has more than one parent page, it will always one "main parent" page.

The main parent page will be used to build the URL to the article.

Create one articleTop of PageThey are several way to create an article :

When editing one page : Click on the Create Article button,

In the Structure panel : Fly with the mouse over one page and click on the Create Article icon. The article will be created with this page as parent.

Articles and parents pagesTop of PageArticles can be linked to parents page by drag and drop its name:

From the Structure tree to another page,

From the Articles panel articles list to a page in the Structure tree,

By dragging a page from the Structure tree to the Parents list of the article when editing an article,

From the Dashboard articles lists to one page the Structure tree.

Article typesTop of PageEach article can be linked to one article type in its parent page.

Article types will define the kind of article and helps the developer to display articles in the good place in views.

Example:

Your website has one home page slider

Editors must be able to select which article will be displayed in this slider

Solution :

In Content > Articles Types, create one Article Type with the name "home-slider"

The editor links the wished article also on the home page.-> The article will have one "main parent" and one 2nd parent, which will be the home page.

In the home page view, filter the displayed articles on the type "home-slider"

The Article type is page dependant : Set the type "home-slider" to one article on the home page will not change its type for its original parent.

One article as linkTop of PageOne article can link to an URL.

To create one link to another page or article in the website :

First save you new article, to display the right option column,

Then drag the pointed page or article from the structure tree to the link area ("drop a link here") of the source article.

To create one link to one external URL :

Write the full URL in the link area. Example : http://partikule.net Click on "Add Link"

Articles fieldsTop of PageHere is a description of the default fields of articles.

These fields can be set through the Ionize article edition panel and through the article options panel.

FieldCan be translatedDescription

Online in YesIf unchecked, the article will not be available for this language

TitleYesArticle's title

SubtiutleYesArticle's subtitle

URLYesArticle's URL, built when typing the title. Can be changed.

Windows titleYesBrowser's window title, displayed when the article is standalone displayed, for example when displaying one post of a blog page.

Options : Attributes

FieldDefaultDescription

IndexeduncheckedIf checked, this article will be available for search functionnality (through the search module)

CategoriesCategories to wich the articles is linked to.It is possible to select more than one category through CTRL+click or CMD+click

ParentsList of parent pages of this article.The main parent page has a purple icon with one "P".

Options : Dates

FieldDescription

DateLogical date of the article. If set, it will replace the "Creation date" when the date is displayed through the tag

Publish dateIf the current date is before the publish date, the article will not be displayed on the website.If set, the date displayed by the article's will be the publish date instead of the creation date.

Unpublish dateIf the current date is after the publish date, the article will not be displayed on the website.

Options : SEO

FieldCan be translatedDescription

DescriptionYesMeta description for this article. Will replace the website's default meta description.

KeywordsYesMeta keywords for this article. Will replace the website's default meta keywords

Options : Operations

FieldDescription

Copy contentCopy the content of the article from one language to another.

Display articles in viewsTop of PageHere is one example on how to display articles in one view.Have a look at the Articles Tag Reference for the complete documentation of this tag.

The tag is an iterator tag which allows to loop through articles.

The tag must be used as child of the tag to display the articles of one page.

// HTML Result :

My article

Article's subtitle, if any

The article's content text

Another article

The other article's content

Media : Files, pictures, videos...

Quick articles links

Allowed media - Add and link one media - Media list & linked pictures - Media meta data - Display media in viewsPictures, music, videos, files can be uploaded through the Ionize File Manager or directly by FTP in your media folder.

Media can be used in 2 ways :

Linked to articles or pages and displayed through ionize's tags,

Added in articles content with the embeded editor.

Media Folder

By default, the media are stored in the /files folder of your website directory.

To change the default media folder, go in the panel : Settings > Advanced Settings > Media.Changing the files folder name through the Ionize Settings panel :- Renames the filesystem folder - Updates media URLs found in the database content.

Allowed mediaTop of PageAllowed type of media can be setup in the Ionize panel : Settings > Advanced Settings > Media.

Setting up allowed media improves security by limiting file upload.

Add and link one mediaTop of PageTo add one media, when you're editing one page or article:

Click on the Add Media button : This will open the File Manager

Browse to the folder in which you will to add your media

Click on the Upload button : This will let you select your medi on your computer

Validate : The media is send to the server

To link one media to one article or page :

Click on the Add Media button : This opens the File Manager

Double click on the wished media : it is linked to the content

Media list & linked picturesTop of PageWe saw how to link media to pages or articles.

In some case you can ask you why to link pictures instead of putting them directly inside the article content ?

Linked media instead of adding them to the content has several advantages :

The media meta data (alternative text, title, etc.) are stored in database, for each media,

Because the media list can be looped in a view, it is easy to build a gallery from media linked to an article,

The tag automatically resizes the picture to the wished size. This preserve the design and makes the page loading faster.

Ordering and editing linked media

To order media, simply move them in the list by drag'n'drop.

The little yellow pen will open the media data window, the little unlink icon will unlink the media from the parent page or article

Media meta dataTop of PageOnce one media is attached to a page or a article, it is encouraged to add some meta data to it.

Once written, these meta data will be linked to the media and if you attach the same media to another article or page, you will find the same data.In other words, once set, you don't have to set again the media meta data of one medium.

To edit the meta data of one media, click on the little yellow pen icon at the bottom of the thumbnail.

Display media in viewsTop of PageThe tag allows to loop through media linked to a page or to an article :

Look at the Ionize Media Tags documentation to see complete features of this tag.

Static translations

Static translations are translated terms (words or sentences) which are not content, but which concerns generally the website interface.

For example, terms like "Go home" or "Submit button" are static translations.

Another example is the common text "Website created by My Agency" at the bottom of the website. This can of course be written hardly in the view, but it could be nice to make it available for each language of the website. So if the user visit the website in french, this text will become "Site conu par Mon Agence", which of course is nicer for french readers.

To manage static translation, go to the Ionize panel : Content > TranslationsMore about static translationsTop of PageStatic translations are stored in a language file, linked to the current theme.

This file is generated by Ionize.

Folder : /themes/your_theme/language/xxx/your_theme_lang.phpIn this example, "xxx" is the language code on 2 or 3 chars, and "your_theme" is the name of your theme.

Using static translations in viewsTop of Page1. Simply add the tag in one of your view.

2. Go to the Ionize menu : Content > Translations3. You will find your term and be able to translate it

Users and Groups

An Ionize user can or not connect to the website and/or to the admin part of Ionize.Each user is in a group.Each group has a level which define its rights in Ionize.

Users and groups are securely stored in the database. The password of each user is strongly encrypted, make it uncrackable in case of database hack.

Groups are defined as follow.

GroupLevelDescription

Super Admins10000Users in this group have all rights in Ionize. The user created during installation is member of this group.

Admins5000Users in this group have all rights but no access to the Advanced settings panel (DB modification, thumbnail edition, extended fields activation / inactivation, etc.)

Editors1000Users in this group can edit all content but have no access to :

Website settings,

Users settings,

Modules administration,

Some module panel depending on the module's access restriction.

Users100This group has no access to Ionize, but can have access to restricted part of the website.

Pending50Contains users waiting for registration acceptation

Guest10Users not logged to the website have this level.

Banned-10Users in this group have no access to the website.

Content Online / Offline

Content (page, articles) can be online and offline.

Set one content offline means this content is not reachable through its URL:The website will return the 404 page.

When you're connected to the admin panel as "editor" or "admin", the offline content will be visible on the website.This gives you a simple way to see how the content will look before putting it online.

Of course not connected users will not see this content online.

What's a theme ?Top of PageA theme is a folder containing :

Views used by the website,

Assets used by the theme (CSS, javascript, design pictures),

Helpers dedicated to the website (navigation helper for example),

Static translations files,

Optional widgets used by the website.

Themes folders are located in the /themes folder of your website.

Important: The 3 folders in red in the following picture (config, helpers, views) must be present in your theme folder.

Create the themeTop of PageTo create and use one theme :

In the folder /themes, create the sub folder "my_theme"

In Ionize, go to Settings > Theme... In the "Options" tab, select "my_theme" as theme and click on Use these themesThat's it, "my_theme" is now the theme used by your website.

Create one page : Views

Pages use views... But, what's a view ?Top of PageViews are PHP file located in the folder /themes/your_theme/views/.

Views are a part of the website theme. They are used by the website to display the content.

Views files have the .php extension.

Pages and articles use views to be displayed.

Views and TagsTop of PageA view displays the website content through tags. We can also say that tags are used in views to display content from the database.

Each view file contains mainly HTML code and tags.Tags retrieve data and are a quick and easy way to display them without writing PHP code.

All usable tags are documented in the Tags Reference part of the current documentation.

Kind of viewsTop of PageThey are 3 kind of views :

View typeDescription

Page viewsLinked to one page through Ionize.Used to display all pages elements :

Pages meta data : Website title, page title

Medias linked to the page

Partials views, like header or footer

Article viewsLinked to one article or to the "Article's views" of one page.Used to display all articles fields.

Partial viewsThese views are used as partial block in other views, for repeating content.For example, if the header of the website is always the same, you will create an "header.php" view and include it in a page view.

Since Ionize 0.9.9, articles views are not really used anymore. Pages views are enough to build most of the websites without the need of using dedicated articles views. The more views you use, the more complex will be the edition of the website. Keep it simple !

Activate pages and articles viewsTop of PagePages and Articles views need to be activated in order to use them in the Page and Article panels of Ionize (to link these views to pages or articles).

To activate views :

In Ionize, go to : Settings > Theme... : This panel shows the views PHP files.

For each view, set a logical name, and set the type ("Article" or "Page").

Save

Edit one page : The view will be available in the Options > Attributes > Views select box.

Create one page viewTop of PageBasically, one page view displays the navigation, the current page content (title, medias, etc.) and loops through the articles linked to the current page.

A page view can also displays articles from another page, even this other page has no URL or is not in the navigation menu of the website.

A page view can also include other views, called "partial" views.

What we will do

We will create one basic Home page for the theme called "my_theme".

This home page will :

Call 2 partial views : header and footer,

Display basic page data

Loop through the articles of the current page

For each article, display the linked pictures

1. Create the "header" view

In the folder /themes/my_theme/views/ :Create the file called "header.php" and add the following code :

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

This header will be called by each page of the website.

It will display :

Basic website's data, such as title, meta_description. For more information, see Website meta tags

The languages menu. For more information, see the Language Tag reference

The navigation menu. For more information, see the Navigation Tag reference

The breadcrumb. For more information, see the Breadcrumb Tag reference

2. Create the "footer" view

In the folder /themes/my_theme/views/ :Create the file called "footer.php" and add the following code :

1

2

Of course the footer could be more complex, but for this example, this simple one is enough.

3. Create the "home_page" view

In the folder /themes/my_theme/views/ :Create the file called "home_page.php" and add the following code :

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

4. Link the view to one page

In Ionize, go to : Settings > Themes... For the file "home_page.php", set the logical name to "Home" and the type to "page"

Save

Edit your home page or create one new page

Select the view "Home" in the view list

The page uses now the view home_page to display its content

To display the page's articles, you need to create some articles linked to this page.

Articles and Types

In a page, some articles are displayed in the main column and other articles need to be displayed in a side column.Article Types make this possible.

Article Types are used by the editor on the articles linked to pages and by the designers in views.

To create a type :

In Ionize, go to : Content > Articles Types Click on the button "New type"

Enter one name, one color (optional) and one description (optional)

Save

Using types in content editionTop of PageThe article type is set in the page articles list.

1. Edit one page

2. In the bottom article list, for each article, set the wished type.

One article can have one type when linked to a page and one other when linked to another page.Article's type depends on the page context of the article.

Using type in viewsTop of Page

Add PHP to views

From release 0.9.9, PHP can mostly be avoided in views.If you need conditional data test, have a look at the chapter Conditions with tags.

1

2// returns the current year

Conditional PHP

Because the PHP code is executed after the Ionize tag parsing, the tags values can be tested.

1

2

3

4

5This content is displayed if the title of the page is "About"

Passing data from one tag to one tag attribute

1

2

3

4

5

6

7

8

9

10

Introduction to Tags

What are tags ?Top of PageIonize tags are XML entities, used in the views of the website to display data.

One tag always start with the

Example of one iteration tag

In this example, we wil iterate through all languages with the tag and display each language name and URL.

Ionize default tagsTop of PageIonize comes with several tags, which can be grouped in families :

Website tags : Data concerning the website : title, meta, URLs, settings, etc.

Navigation tags : Navigation through pages

Languages Tags : Navigation through languages

Page tags : Data from pages

Article tags : Data from articles

User tags : Data from user

Media tags : Data from media

Form tags : Display and process forms

Common Tags

Common data tagsTop of PageSome data tags are the same for several parents tags.

For example, the tag can be used as children of but also as children of TagParent tagsExample

page, article, media

page, article, media

page, article, media, category, language

page, article, media

page, article

page, article

writerTop of PageDisplays data about the article's last editor.

Parents : ,

Special Tags

partialTop of PageReturns the result of a view used as partial.

1

2

AttributeOptionalValues

viewnoThe path to the view, relative to the themes/your_theme/views folder.

uriTop of PageTag : Gives information about URI and the asked entity.

Get the URI entity type :

1

2

Make a test on the entity type :

1

2

3

4

5

6This is a page

This is something else

sessionTop of PageThis tag uses the Session library of CodeIgniter.See : CodeIgniter SessionsSet one session value

1

2

3

4

5

6

7

8

"my_var" is not set.Reload the page to set it was just set.

Get one session value

1

2

3

4

Session value :

set / getTop of Page and can be used to set and get data.

Setting one value :

1

Get one value :

1

can be used to get one field from its parent context tag data:

1

2

3

4

5

6

7

... do something here

traceTop of Page is to be used in development, to see the content of data array.

This tag will output the data array.

1

2

3

Shared attributes

Some commons attributes are used by all tags which returns data.

These attributes have the same behaviour for each tag, like the "class" attribute of HTML tags.

HTML Design attributes

tag : Wraps the data inside the given tag

id : Adds to the wrapping tag the given ID

class : Add to the wrapping tag the given class

Using the tag attribute is very useful because it will not return one empty tag if the value is empty.

Services

Without the tag attribute :

Data processing attributes

These attributes are useful if you need to process the data through one simple PHP function or through one CodeIgniter helper.

function : processes the data through the given PHP function

helper : process the data through the given CodeIgniter helper

String processing attributes

prefix : Adds one prefix to the data

suffix : Adds one suffix to the data

paragraph : Limits the data to the given number of paragraphs

words : Limits the data to the given number of words

characters : Limits the data to the given number of characters

ellipsize : strip tags from the data, split it at a defined maximum length, and insert an ellipsis

prefix / suffix

This attribute can have one simple string as value, but also one translation.See Static Translations for more info about lang keys.

Read more about : My Article

Lire la suite de : Mon Article

Read more about : My Article

Post in categories : My Category

The suffix attribute has the same behavior than prefix.

paragraph, words, characters, ellipsize

These attributes will limit the displayed content.

Date formatting attribute

This attribute works only on date tags.

One basic usage is to set one PHP date format to output the date :

Short formatted date

If one of the following format is used, the corresponding translation will be searched first in the /themes/your_theme/language/xxx/date_lang.php file, then in the core translation file if your date translation file isn't found :

D : Name of the day, on 3 chars.

l : Name of the day, long.

F : Name of the month, long

M : Name of the month, on 3 chars

That means the day and month names will be displayed in the according language, as translated in each translation file.

The following code will display "Mon" if the user visit the website in english and "Lun" if he visits the website in french.

Long formatted date

But one common issue is that date format are not the same from one lang to another.In US, one common date format is 12.31.2012, but in France, the day displayed first, so this date will look like this : 31.12.2012.You may also wish to display the month in words, like december 31. 2012 or 31 dcembre 2012.

To do that :

1. Copy the file /application/language/xx/date_lang.php to /themes/your_theme/language/xx/date_lang.php in each "xx" lang folder,

2. Open the copied lang file and edit the keys $lang['dateformat_short'], $lang['dateformat_medium'], $lang['dateformat_long'] or $lang['dateformat_complete'] depending on your needs.For example :- in en/date_lang.php: $lang['dateformat_medium'] = 'M d Y';- in en/date_lang.php: $lang['dateformat_medium'] = 'd M Y';

3. Use the format attribute like this :

31 dec 2012

dec 31 201

Be sure that the files date_lang.php are existing for each language of your website.

Test and Conditional attributes

These attributes test the value returned by the tag and display the enclosed content only if the tag value match the test.

is

expression

is

Simple test against one given value.

This is the first article !

expression

Equality test

When the key to use isn't given in the expression, the tag value is used :

Yiiii, this is the article

... not happy... this is not the article

Take care to the equal test "==" used against strings : the string must be wrapped into single quotes.

Greather than

Wer're after the third article

Wer're after the third article

Lower than

Wer're before the third article

Wer're before the third article

Multiple test

For multiple tests, the used keys must be explicitly written.

Index