Category: "EzPlatform / Ibexa"

CSV export out of eZ Publish

A team member requested a list of users and email addresses from an eZ publish site, and I remembered seeing a file called under php/bin.

After a few tries, I found the following sequence of commands worked really well.

cd ~/public_html/ez
/usr/local/bin/php -C bin/php/ezcsvexport.php 12 –storage-dir=$CSV_EXPORT_BASE -smsite -q -l export -p password 2> /dev/null
rm $CSV_EXPORT_BASE/*.png 2> /dev/null
rm $CSV_EXPORT_BASE/*.jpg 2> /dev/null
rm $CSV_EXPORT_BASE/*.gif 2> /dev/null
rm $CSV_EXPORT_BASE/*.bmp 2> /dev/null
sed “s/\([^\;]*\);\([^\;]*\);[^\|]*[\|]\(\|[^\|]*\)[\|].*$/\1,\2,\3/” $CSV_EXPORT_BASE/user.csv | grep -v ‘;’ | grep ‘@’ | mail -s “eZ Guest Accounts”

This created a file called user.csv, which was delimited with semicolons and included all the information. The account information (username, email, etc) was serialized, meaning separated with vertical bars or piping characters. I used sed to replace the semicolons with commas, and find the second element of the user account data (the email address). Some people had added signatures, so one grep command was used to get only those lines with @s in them, since that indicates an email address. Finally the whole thing was piped through mail and sent to the requestor.

The export script saved me a lot of time.

eZ Publish RewriteRule to redirect a URI match site to hostname

The old site had eZ publish installed in a directory called cms, and running in URI match mode. These redirect rules allow people who have bookmarks and favorites to the old site to reach the correct pages in the new site.

RewriteRule cms/index\.php/plain_admin$ [R=301,L]
RewriteRule cms/index\.php/plain(.*) /$1 [R=301,L]
RewriteRule cms/index\.php$ / [R=301,L]

Advantages of Integrated Content

  • Seamless, cost-effective integration. Only one instance of the design must be maintained, and, since it is sourced from a single point, it will look better, and adjust as the content changes.
  • Unified search results. A single search function can search all elements of the site, the content, forums, blogs, images, contact opportunities.
  • Ease of navigation. Navigation through a single application is generally simpler than paging through different ones. Consistency is assured.
  • Single administrative interface. Content editors and maintainers only have to learn how to use one system.
  • Reduced cost. eZ Publish is free.
  • Effective cross-referencing tools. eZ’s editor has an excellent way to linking within the site to help a visitor find additional information. If the content changes, the link will adjust.
  • SEO. Building a single site with a robust collection of content consolidates the resources. Distributing them to other domains and subdomains may dilute the effectiveness of the content. In addition, the majority of the page rank equation is computed from external links to the site, the more links from high-ranking pages you have to your site, the higher the rank. Even if the blog is on a separate subdomain or domain, it won’t significantly increase page rank unless it becomes very popular.
  • Content is still king. The location and software running the blog is secondary to the content. Without quality posts, the blog will not attract readers or followers.
  • Visitor participation and contributions. Using a single application allows people to register and share their ideas in more than one area, commenting on a blog or post, accessing restricted content, joining a forum, or even contributing posts.
  • Corporate, brand, and product focus. A single central site ensures visitors are focused on the company, brand, and product. They won’t get lost during transitions to other sites, or frustrated by new page loads.
  • Control. Hosted applications limit the control available, for example the addition of bookmarking links.
  • Visitor trends, statistics and tracking. Distributing the tracking across different systems makes it more difficult to monitor visitors behavior.

eZ Camtasia

This datatype was a lot of fun to build.

The objective was to allow people to upload Camtasia .zip files (videos) into eZ publish.

The strategy was to extend the eZBinaryFileType. When the attribute content is requested, the code checks to see if the .zip file data has been extracted and prepared for use. If it hasn’t, the .zip file is extracted and the HTML is filtered to retain only the tags necessary to deliver the video. The filtering includes updates to the paths in the HTML.

The display template assembles the URL of the HTML file and then uses an include call to bring it into the display.

One of the most interesting things I learned was how to use the PHP ZipArchive class (

eZ Publish Rounded Image Corners

Nutshell explanation:

Make these changes to allow rounded image corners under eZ publish.

All .gifs and .pngs will have their corners rounded.
No .jpgs will have their corners rounded, unless you use the rounded aliases below, which force the output type to .png.

ez/settings/override/image.ini.append.php settings

<?php /* #?ini charset="utf-8"?






# This line causes ALL images to have their corners rounded.  Only .gifs and .pngs will display with rounded corners, .jpgs
# will display with sharp corners, because they don't support transparency.  If a .jpg image is uploaded, the display class
# must be set to one of the above for the rounded corner version to display.
# The PostParameters settings must also be applied before the destination file name, modify /var/www/html/ez/lib/ezimage/classes/ezimageshellhandler.php
# Thanks to:
PostParameters=\( +clone -threshold -1 -draw "fill black polygon 0,0 0,10 10,0 fill white circle 10,10 10,0" \( +clone -flip \) -compose Multiply -composite \( +clone -flop \) -compose Multiply -composite \) +matte -compose CopyOpacity -composite

*/ ?>


        if ( $filters !== false )
            foreach ( $filters as $filterData )
                $argumentList[] = $this->textForFilter( $filterData );

        /* Move PostParameters up before the destination file is named */
        if ( $this->PostParameters )
            $argumentList[] = $this->PostParameters;

        $destinationURL = $destinationMimeData['url'];

… same file … to help you see the command being executed …

system( $systemString, $returnCode );

1 2 4 6