At a Website Near You: Setting up ezsystems.ca

As the company behind eZ Publish, we at eZ Systems have naturally been using our own software to power our main ez.no website since we started in 1999. Hey, we're eZ Publish experts! So when it came time to set up our North American presence here at ezsystems.ca, we figured we would take this opportunity to be a live example of what eZ Publish can do. We invite you to come along for the ride, which we will document every step of the way.

After installing the latest stable release of eZ Publish (3.9.2), our web presence looked like this:

eZ Publish out of the box

eZ Publish out of the box

A bit of work later, and our website now looks like this:

ezsystems.ca September 10, 2007

ezsystems.ca September 10, 2007

Yes, it still has an "Under Construction" banner (albeit of the beautiful downtown Vancouver skyline), but in the next few weeks Vivien will be completing the skinning process to give this site an eZ look.

Here are the highlights of what we've done so far and how we did it:

Top right links

To remove the Register and Tag cloud links, which we will not be using (yet), we first logged into the Website Interface by clicking on the Login link in the top right. After successfully logging in, we clicked on the Site settings link to bring up some built-in template options.

Edit template options

Edit template options

When we remove the site settings label (as well as the tag cloud label), eZ Publish will no longer generate these links.

However, you could still access the registration page by manually accessing http://www.ezsystems.ca/user/register, so we added this to settings/override/site.ini.append.php:

[SiteAccessRules]
Rules[]
Rules[]=access;disable
Rules[]=module;user/register

Menu tweak

Of course, we removed a lot of the default content and added our own content, but an extra menu item to note is the "Home" link. Although you can click on the eZ logo to go to our ezsystems.ca front page, we wanted an extra, more visible link. The process for adding this link is described in the ever-so-timely How to Configure an eZ Publish Site article that was just released.

One extra tweak on the "Home" link was to add an underline to that link whenever you are on the home page, just as the "Blog" link is underlined whenever you are reading our blog.

Underline the "Home" link on the "Home" page

Underline the "Home" link on the "Home" page

To do so, we edited the template file for the top menu (/extension/ezwebin/design/ezwebin/templates/menu/flat_top.tpl) and found this code, which populates the menu:

{foreach $top_menu_items as $key => $item}
  {set $item_class = cond($current_node_in_path|
eq($item.node_id), array("selected"), array())}

Directly below that code, we created an "if" statement so that if the current page has a Node ID of 2 (that's the home page) and if the link has a Node ID of 181 (that's the "Home" link), it invokes the "selected" CSS class:

{if and($current_node_id|eq(2),$item.node_id|eq(181))}
   {set $item_class = $item_class|append("selected")}
{/if}

Blog tweaks

eZ Publish comes with a plethora of built-in content classes (such as the Blog post class), providing a handy framework for many different situations. However, we wanted to add an Intro attribute in addition to the Body attribute of a blog post. This way, we can show only the Intro attribute of each post when displaying the top-level blog page. Visitors can click on the title (or a "Read more..." link as described in a bit) to read the full post.

The powerful Administration Interface makes it easy to tweak a content class, even on a live site. Click on the Setup tab, then on the Classes link. Click on the Content group, then edit the Blog post class. Add an attribute called "Intro" that is of the XML Block datatype.

To make the Intro attribute visible in the full view and summary view (which the aggregate top-level blog uses), we dove back into the templates.

The full view template is found at extension/ezwebin/design/ezwebin/override/templates/full/blog_post.tpl. We simply found the body div and added an extra line for the Intro attribute.:

<div class="attribute-body">
  {attribute_view_gui attribute=$node.data_map.intro}
  {attribute_view_gui attribute=$node.data_map.body}
</div>

For the summary template at extension/ezwebin/design/ezwebin/override/templates/line/blog_post.tpl, we replaced the reference to the Body attribute with a reference to the Intro attribute, and also added a "Read more..." link:

<div class="attribute-body">
  {attribute_view_gui attribute=$node.data_map.intro}
  <p><a href={$node.url_alias|ezurl} 
title="{$node.data_map.title.content|wash}">
{"Read more..."|i18n}</a></p>
</div>

Allowing anonymous users to comment

By default, visitors must have an account on an eZ Publish site and be logged in to comment. However, to open this blog up to the public, we decided to let all users comment.

This basically means that the Anonymous user must be allowed to create Comment objects. Therefore, go to the User accounts tab, then click on the Roles and policies link on the left.

Edit the Anonymous role, then click on the New policy button. Then grant limited access to the Content module, and limited access to the Create function to create objects of the Comment class (optionally if the parent object is of the Blog post class).

Content tweaks

As you can see, we added some content so that you have a better idea of what we do and how our products and services can help you.

The power of the built-in Frontpage class allows us to syndicate content on, appropriately, our front page.

Therefore, we can pull our latest blog posts and some "about eZ" information (which are both maintained in their respective location). To ensure that new information such as a blog post is always automatically updated on the front page, we have to make a few tweaks to the settings files. This is because the eZ Publish viewcaching system automatically stores static files of pages (as explained in this article) to eliminate the continuous need for dynamic page generation and to improve site performance. However, we can finetune this.

In settings/override/site.ini.append.php, add:

[ContentSettings]
ViewCaching=enabled

In settings/override/viewcache.ini.append, add:

[blog_post]
DependentClassIdentifier[]=frontpage
DependentClassIdentifier[]=blog
ClearCacheMethod[]=object
ClearCacheMethod[]=parent
ClearCacheMethod[]=relating

That's all for now!

Comments

Comments are closed
eZ publish™ copyright © 1999-2010 eZ systems as