Wednesday, October 29, 2008

eZtip: Get the current siteaccess from template

I'm currently working on a multilingual site and had to use the name of the siteaccess in the template code. Easy I thought...well it took quite a while to find.

From http://ez.no/doc/ez_publish/technical_manual/4_0/templates/the_pagelayout/variables_in_pagelayout

VariableTypeDescription
$access_typearrayThe name of the siteaccess (as "name") and the ID number (as "type") of the access method that was used (1=URL, 2=Host, 3=Port).


Adding {$access_type|attribute(show,2)} to the pagelayout.tpl template will give the following:

name string 'ezwebin_site'
type integer 2


The siteaccess used to serve the current page is accessible via $access_type.name

Wednesday, October 15, 2008

French version of "10 Tips for New eZ Publish Developers"

Some days I absolutely love the internet and the possibilities it enables. Today I got a real buzz when I leaned that Clochix has created a French version of my previous post, "10 Tips for New eZ Publish Developers". It doesn't appear to be a straight translation and contains additional thoughts on most of the points.

What Clochix does point out is that many of the tips could apply to most applications, and he's 100% correct on this. Many of them are common sense. Trouble is that time and time again I've see projects (and not just eZ projects ) that don't "follow the rules". Sometimes it's good not to assume that people know and to state the basics!

Thursday, October 09, 2008

10 Tips for New eZ Publish Developers

1/365 [dazed & confused] (by PhotoJonny)We've all been there, starting out with a new product and not knowing where to begin. Below are my top 10 tips for new eZ publish developers.

  1. Read the install documents and make sure your system meets the requirements before beginning. eZ Publish has some hefty needs in terms of memory limits and timeouts that may not be set at recommended levels in some PHP setups. Not having these values set to acceptable levels will impact on a successful install.
  2. Don't modify the core distribution. Just don't, no matter how tempting it is. There is no need to modify any files that come as part of the eZ Publish distribution. This will save you losing any changes when you upgrade.
  3. Understand the basics. eZ Publish doesn't store content in straight database tables like other Content Management Systems. Read the documentation and understand the content model. eZ Publish is all about content objects arranged in a tree, not data stored in tables.
  4. Debugging holds the answers. If something is not working as expected turn on debugging and check the output. Most times the answer or a pointer to what is wrong will be found in the debug output. Check the Web Server error logs for issues as well. If this still doesn't help, clear the caches and try again.
  5. Use the Community. If you still have trouble, use the forums. There is a great developer community around eZ publish and they are usually happy to help.
  6. Provide enough information. Include as much information as possible in your forum post. Include a detailed explanation of what you are attempting to achieve, what is or isn't happening, code samples, specifics of your setup and debug information.
  7. Don't "force" it. If something seems overly difficult it usually means that you aren't approaching it in an optimal way. As with most things there are several ways to achieve the same outcome, some better than others. Ask the community for help (see above).
  8. Comment your code. Before you start to write any code (templates, PHP, settings) describe what you are going to achieve in a comment. This will not only help you focus on what is required but serve as documentation for anyone who has to work with your code in the future. Remember this may be you in 6 months time.
  9. Write readable code. Follow a coding standard. eZ have a number for various aspects of the system: Templates, PHP & SQL. There used to be a PDF eznetwork_development_guidelines.pdf up on the eZ site that contains all this info and more but it longer exists - eZ people can this go back? If you are interested email me/comment for a copy.
  10. Plan ahead. Document what you are going to do before starting. This doesn't have to be elaborate or time consuming but will save you time in the long run as well as providing a guide to how the site was put together. I've found that the absolute basics are a sitemap, and a list of content types, their views and how they are applied in the site.
What do you wish someone had told you when you first started using eZ Publish?

Friday, October 03, 2008

Web Directions South 08 - Day 1

I'm been meaning to attend a Web Directions Conference since they started but it always clashed with other commitments.

This year I made the trip to Sydney for Web Directions South 08 and it was well worth it. Web Directions always provides a great program of both international and local speakers as well as a fantastic bunch of attendees.

As with most conferences there were a number of parallel sessions and often the choice of which to attend is difficult. On the first day I attended mostly technical sessions, which in retrospect was probably a mistake.

This is a run down on the sessions I attended on day one.

New media - new business

Lynne D Johnson presented the opening keynote which covered how various generations interact with of new technologies and what this means for traditional media providers. The content of the session was perhaps aimed at a less "online" savvy crowd but got interesting when examples and case studies came out. Some interesting ideas where raised regarding the mix of social networks as a means of getting the audience to engage traditional media.

Lynne's keynote (by Halans) Lynne presented a bunch of stats and one interesting fact came out for me and that was: The younger demographic assume what they put online is public unless specifically made private while older generation is the opposite.

The session finished up talking about the future of traditional media and concluded that there would be a decline in the demand and production of newspapers, books and magazines due to increasing online consumption. However print would not die out but become a niche market, with smaller print runs and increasing in cost.

The session has some interesting points but mostly missed the mark with the Web Directions crowd. Would have loved to hear more of Lynnes' experience as Community Director at FastCompany.com

Start Using Web Vector Graphics TodayWebjam 8 - Bar Broadway - Sydney (by Charlie Brewer)

Dmitry Baranovskiys session started out giving an overview of the various web vector graphics technologies that are currently available in browsers, SVG, Canvas & VML and then introduced his Raphaël JavaScript library.

Raphaël is quite impressive as it allows you to create cross-browser vector graphic using JavaScript. Current supported browsers are Firefox 3.0+, Safari 3.0+, Opera 9.5+ and Internet Explorer 6.0+ as well as the iPhone & iTouch.

Raphaël has been on my list of things to check out for some time and this engaging talk pushed it up the list.

From disordered to managed usability in an Agile environment

Teale Shapcott gave a presentation about Agile methodologies utilised at Suncorp and the benefits (and challenges) of introducing usability into the production cycle. This was a great talk, providing many "real world" issues and solutions.

Teale is presenting what looks to be a similar talk at the Brisbane Web Design Meetup on October 9. Well worth attending even if you saw the WDS08 presentation!

Javascript libraries - Putting the cross in cross-browser compatible

Web Directions South (by CannedTuna)This session was a "compare and contrast" of a number of popular JavaScript libraries, as well as raw JavaScript. The session was chaired by Craig Sharkie, with Earle Castledine representing jQuery, Ben Askins Prototype/Scriptaculous, Jason Crane YUI, and Cameron Adams writing JavaScript from scratch. Each panel member introduced their library and then presented solutions to problems that had been posed by Craig.

It became quite clear very quickly that:
  • Using a library saves for a bunch of time. One problem took more than a day to do from scratch while all the library users achieved most solutions in less than 15 mins.
  • Libraries work across most platforms, achieving this in raw code is hard.
  • Most panel members actually use jQuery.
Nothing shocking there!

Although the panelists were quite entertaining the session got a bit repetitive (2 hours worth), with the library panelists presenting their minimal solutions (most one liners) and wading through the raw JavaScript version.

The session ended up with each panelist presenting a "free" exercise using their assigned library. The highlight of which was the remarkable Man in Blue's raw JavaScript sequencer.

Predicting the Past: Emotional Design and a Vision for Microsoft Surface

WDS08 (by Halans)August de los Reyes presented the closing keynote for day one and had some very interesting points on the part that emotion plays in design. However the talk was interspersed with a 2+minute Seinfeld clip (made a good point but was too long) as well as several Microsoft "marketing" clips, that seemed a little out of place. They presented a vague "Minority Report" future and left me feeling that I was being marketed to. This really detracted from the excellent research and ideas that August was talking about.

I found it hard to link the promise portrayed in the videos to what I saw in the Surface table at the Microsoft stand, especially in this day of portable connectivity. The Surface interface is impressive, I guess the table top arcade style casing makes it seem like something of that era and not of the future.

Day One Wrap

The thing I love about conferences is that you get to meet a bunch of great people and hear plenty of exciting ideas. Web Directions is no exception.

In hind site I probably would have skipped Dmitry's vector Graphic talk for Derek Featherstones Accessability beyond compliance talk. I also would have given the JavaScript comparism talk a miss and attended Hurol Inans session "Informing experience architecture with quantitative insights"

After the closing there were drinks and nibbles and then it was on to WebJam8.

Day 2 to follow....

Thursday, October 02, 2008

How to you handle Revision Control for eZ Publish Projects?

Ch-ch-changes (by TW Collins)
Revision control systems (RCS) play an essential part of any software development process. One reason for using a RCS is to enable applications to be rolled back and deployed from a known point in time. Due to the nature of eZ publish it's difficult to capture all changes in the RCS and this often leads to the requirement of manual adjustments when changes are deployed.

An eZ publish project is made up of a number of elements that are stored either on the file system or in the database. The database not only stores the site's content but also a number of "configuration" items, such as roles & policies, content class & workflow definitions, RSS feed configurations and URL translations (I'm sure there are more).

Another scenario where this feature will pose an issue is if you use a node override to utilise a specific template for a particular node. In this case the entry in override.ini relies on a specific node_id to link the template to the node. It's unlikely that the node_id of the development system will match the live system and the deployment will fail. Roles and policies will also suffer from this issue as they are reliant on content e.g. applied to a specific node subtree or applied to a user group.

These configuration items play an important role in a correctly functioning eZ Publish site. The reliance of configuration information stored in the database makes it difficult to capture this information in revision control in a way it can be automatically deployed or rolled back from the RCS.

Earlier this year Jérôme Renard published an great article entitled Using Subversion with eZ Publish that touched on this point, suggesting that some tables can be exported from the database and the resulting dump included in the RCS. While this would work ,it relies on the developer remembering to do it when changes are committed. It aslo means that the specific configuration changes are not captured in the RSC with any associated file changes. i.e. It's not easy to look at the diff from the previous commit and see what changed.

I suspect that eZ Publish is not the only platform effected by this issue. While not the exact problem, Ruby on Rails solves a similar issue though use of migrations where database changes for both the update and reverse it are stored in files and applied programatically.

How to you address this issue this for your eZ Publish projects? Database dumps? The eZ package system? Home grown scripts? Something else?