eZ Community » Blogs » Harry Oosterveen » Create a CD-ROM from your eZ Publish...

By

Create a CD-ROM from your eZ Publish site

Thursday 16 August 2012 11:59:44 pm

  • Currently 4 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Targeting an audience with often poor Internet connections, IRC wants to provide information not only on the web site, but also on CD-ROMs. Using this tool, we can create a copy of (part of) our web site on a CD-ROM.

Background

It started when colleagues came to me with a large collection of Word and PDF files, to be shared on some conference with the participants: can you put these on a CD-ROM?

Sure, they can be copied to a CD-ROM, but to make it more user-friendly, you'd have to create some kind of interface that organizes the files in groups/folders, and describes the folders and files.

This can easily be done on the eZ Publish web site, creating a folder for each CD-ROM, perhaps sub-folders with appropriate names and descriptions, and store each file as an object of a suitable class. My colleagues can do this themselves, they best know how to organize and describe those files.

With this tool, I can export the whole folder, with an appropriate menu. And re-create it easily after some last-minute changes.

The tool also was very useful when a number of sites, hosted by us, where terminated, to create an archive copy. After reading how this works, you can probably think of some useful applications in your sitation as well.

How does it work?

You can download the tool as an eZ Publish extension ho_export on Github.
The tool runs as a script, bin/php/export.php. Information is read from the export.ini settings file.

First step is to find all the nodes. It starts with the given top node, and in a recursive function, it adds all child nodes (or their main nodes if these are additional nodes), and the child nodes of the child nodes, etc.

After a list of all nodes that will be included in the export has been created, it will loop through this list, and create the page for each node. It uses a simple page template and the standard content/view templates, including a simple menu of the higher level nodes. In the page, links will be checked and replaced when appropriate: binary files, images and design files (stylesheets, javascript files) are copied and the links to the copied files are used instead..

The copy is created in the var/[site]/export folder. After creating all pages, the complete set is zipped to easily download it.

Configuration

All configuration is stored in the export.ini file.

You can create several exports from the same site; each export is described in a section in the export.ini file. The most important variable is the TopNode, the NodeID of the top node of the subtree that will exported. The other variables are the template to be used for each page, the logo, the template for autorun file, shortcut icon, title, and footer text.

Run

Once these variables are set, you can create the export copy from the shell:

php extension/ho_export/bin/php/export.php -s <site-access> <section> [-u <username>]

The username is an optional parameter, so you can access objects that are not accessible for the anonymous user.

Alternatives

Of course, you can create an offline copy of your site with a programme like HTTrack. For a complete site, that is a better option. This tool is particularly useful to create an offline copy of just a part of the site, e.g. as a tool to create contents for a CD-ROM.

Any suggestions for other tools to create offline content?

Proudly Developed with from