Posts

Showing posts with the label eztips

eZtip: Character Encoding in Templates

Image
Recently I was working on a multilingual site and had to add some static text in a number of languages. I added the supplied text and then viewed the resulting page. Having previously lost many hours of my life to dealing with character encoding issues I momentarily regretted I'd gotten out of bed when confronted with mess that was before me. Quickly regaining my composure I realised that eZ Publish must be doing the transformation and with a bit of digging I discovered that by default templates are seen by the system as being in iso-8859-1 and are converted into utf-8 for display. In my case eZ Publish was doing what it was told and converting the already utf-8 characters in utf-8. There are 2 options for telling eZ publish the character encoding of a template. Firstly you can configure eZ publish that all templates are utf-8 by editing template.ini.append.php in overrides for the entire site or your specific siteaccess to limit the effect. [CharsetSettings] # The charset to us...

eZtip: Errors can be misleading...what happens when the DB is dead

Image
I recently received an email from an eZ community member stating after an abnormal system reboot that their working eZ Publish install was reduced to responding with "Error / kernel (1) Access denied" My suspicion was that there was an issue with the database. More than likely it had not successfully started when the system was brought up again. I tested this theory by stopping the database in my local development environment and accessing the associated eZ Publish site. Manually editing the settings/siteaccess/eng/site.ini/append.php to turn on debugging confirms the problem and gives an insight into what is happening: Warning: PHP mysqli_connect() [<a href='function.mysqli-connect' >function.mysqli-connect</a>]: (HY000/2002): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /var/www/ezpublish-4.0.0-ezwebmin/lib/ezdb/classes/ezmysqlidb.php on line 132 Error: eZMySQLiDB Connection error: Couldn't c...

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 Variable Type Description $access_type array The 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