Path

ez projects / xrowmetadata / forum / general / bug with keywords generation / re: bug with keywords gener...


Bug with keywords generation

You need to be logged in to post messages in the forums. New users may register here.

Edi Modrić

Member since:
22 January 2009

Posts: 59

Thursday 12 January 2012 10:15:41 pm

Hi guys,

there is a bug with keywords generation process in your code. Specifically, datatypes/xrowmetadata/xrowmetadatatype.php, "fetchMetaData" function.

The problem is the following line ( part of new xrowMetaData( .... ) ):
explode( ",", htmlspecialchars_decode( (string)$xml->keywords, ENT_QUOTES ) ),


explode does not return an empty array when the string is empty, but rather, it returns an array with one element, an empty string, which screws up your sample page_head.tpl that only checks for keywords with {if $meta.keywords}

Here is the corrected method that works fine.

https://gist.github.com/1603175

Certified as an eZ Publish advanced developer on Sep 7th 2012
Certified as an eZ Publish basic developer on Jul 16th 2010

@: http://twitter.com/emodric
www: http://www.netgenlabs.com

Up

Marco Zinn

Member since:
11 March 2003

Posts: 27

Saturday 10 March 2012 12:31:57 pm

I can confirm the "Check for Empty" issue and Edi's Fix with Community Project 2011.12

Thanks for Sharing, Edi
Up

Georg Franz

Member since:
09 January 2008

Posts: 14

Tuesday 26 June 2012 7:17:05 pm

Hi,

I've added your fix, thanks!
Up

Edi Modrić

Member since:
22 January 2009

Posts: 59

Thursday 28 June 2012 10:55:03 pm

Good to hear that :)

Certified as an eZ Publish advanced developer on Sep 7th 2012
Certified as an eZ Publish basic developer on Jul 16th 2010

@: http://twitter.com/emodric
www: http://www.netgenlabs.com

Up

You need to be logged in to post messages in the forums. New users may register here.