Article

eZ publish: PHP's Killer App - Parts 1-3

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 Next

site.ini

In Part 1 of this series you renamed this to site.ini.php and made some basic changes to get your site up and running. I'll refer to it from now on as just site.ini, to stay in line with the eZ publish documentation.

This file contains global settings for the whole of eZ publish, as well as settings that apply to specific eZ publish modules. Given the size of the file, I'm not going to cover every setting, but rather highlight some important ones, and explain the mechanisms for updating site.ini. You should find most of the settings self-explanatory.

But first of all, make a backup and put it somewhere safe.

At the top of site.ini you'll find settings that apply to the whole site. Let's begin by modifying these.

# Meta content variable      
SiteAuthor=HarryF      
SiteCopyright=HarryF © 2002      
SiteDescription=PHP: Getting the point?      
SiteKeywords=PHP, Development, Tutorials, Articles

These determine HTML <meta> tags that appear on the top of each page. Note that eZ publish modules like eZ article may override SiteDescription and SiteKeywords with values you create with your articles: this is very useful if you want to tell Google all about an article you've written. The settings here amount to the default settings.

Let's see some more:

DefaultPage=/article/frontpage/1/      
LogFile=error.log      
EnabledModules=eZArticle;eZTrade;eZForum;eZLink;eZPoll;eZAd;      
eZNewsfeed;eZBug;eZContact;eZTodo;eZCalendar;eZFileManager;      
eZImageCatalogue;eZMediaCatalogue;eZAddress;eZForm;eZBulkMail;      
eZMessage;eZQuiz;eZStats;eZURLTranslator;eZSiteManager;eZUser      
CacheHeaders=true      
...      
URLTranslationKeyword=section-standard;section-intranet;section-trade;      
section-news      
Sections=enabled      
DefaultSection=1

Ok, let's go through this code step-by-step.

The DefaultPage determines what appears on your home page, i.e. http://localhost/public/ezpublish_2_2_6/index.php is, in this case, the same as http://localhost/public/ezpublish_2_2_6/index.php/article/frontpage/1/.

The log file you saw in Part 1 of this series is used to keep track of what administrators do to the site, and any application errors that occur. It's very useful if you have a big site with many people working on it.

EnabledModules is self-explanatory.

CacheHeaders controls the browser caching headers delivered with the HTTP protocol (it determines whether a browser use its own, locally-stored copy, or fetches a new one from your site) -- best to leave this as it is.

URLTranslaterionKeyword you'll see more of when we get to eZ article -- essentially it helps make "pretty" URLs, so that, rather than http://localhost/public/ezpublish_2_2_6/index.php/forum/forumlist/1/ you could have http://localhost/public/ezpublish_2_2_6/index.php/forum/.

Sections allows you to have multiple "styles" for your site (a bit like skins), each with a different look and feel, offering access to different eZ publish modules. In conjunction with this, DefaultSection tells eZ publish which to use on the home page, or if it's uncertain which style to use at any point. I'll look more at sections shortly.

After this, the other settings you'll need to worry about apply to the modules, such as:

[eZAdMain]      
AdminTemplateDir=templates/standard/      
TemplateDir=templates/standard/ImageDir=images/standard/      
Language=en_GB      
DefaultCategory=1      
DefaultSection=1

You'll be seeing more of this soon. In each of the eZ publish module directories, you'll find a file called site.ini.txt, which gives the meaning of each of these variables.

Caching

Aside from the generation of HTTP headers that tell browsers what to do when caching Web pages, eZ publish has its own internal caching mechanism used to store "parsed" output. Once a page has been viewed, eZ publish can deliver the cached version rather than rebuilding the entire page, thereby improving overall performance. When you modify eZ publish's design, you'll need to be aware of how caching works -- otherwise you'll be wondering why you can't see your changes. The internal caching mechanism is used essentially in three ways:

  1. The directory [ezPublish_root]/classes/cache/ is used to store PHP scripts and variables. The contents of site.ini will be found in parsed form here, along with variables that eZ publish has assigned for a whole range of operations. If you make changes to site.ini you'll need to delete the files in this directory for your changes to take effect.
  2. In site.ini you'll find the following settings:
  3. SiteCache=disabled      
    SiteCacheTimeout=60

    The SiteCache attempts to cache every page of eZ publish. This is only useful for sites where most of the content is static. For sites using the forum module, for example, it's best to leave this disabled. The SiteCacheTimeout tells eZ publish when a cached page can be regarded as having expired (in minutes) and requires re-creating.

  4. For certain modules, such as eZ article, you'll also find a "PageCaching" setting in site.ini, which can also be enabled or disabled. When you work on the visual layout of a module like eZ article, it's a good idea to set this to "disabled", so you'll be able to see any changes as you make them. Also, if you publish an article and then make changes to it, you'll need to delete its cached version in [ezPublish_root]/ezarticle/cache/.

In the administration back end of eZ publish you'll find Cache Admin tool under the Site Manager section (second from far right). This works nicely if you've got eZ publish installed under Linux, but sadly not with Windows (you'll have to delete cached files manually with Explorer).

If you liked this article, share the love:
Print-Friendly Version Suggest an Article

Sponsored Links