OPF metadata properties

Recommend this page to a friend!

      EPub  >  All threads  >  OPF metadata properties  >  (Un) Subscribe thread alerts  
Subject:OPF metadata properties
Summary:Including metadata properties for EPub 3.0 spec
Author:Callum West
Date:2015-11-13 16:03:49

  1. OPF metadata properties   Reply   Report abuse  
Callum West - 2015-11-13 16:03:49
Love the class and its flexibility. One thing I have noticed is that it doesn't seem to offer the ability to include properties for metadata items. Example below.

<dc:creator id="something" dir="ltr" xml:lang="en">John Doe</dc:creator>
<meta refines="#something" property="file-as">Doe, John</meta>

I have hacked in a custom method to the OPF -> Metadata class to add properties, and expanded the OPF -> Metadata -> finalize method to add the properties in if using the EPub3 spec, but this hack is just really to suit my system and not very pretty.

Do you have any suggestions on a clean way to go about doing this with the current classes available and not expanding/extending them?

Many thanks


  2. Re: OPF metadata properties   Reply   Report abuse  
Asbjorn Grandt - 2015-11-13 16:49:13 - In reply to message 1 from Callum West
Can you use



$metaValue = new DublinCore(DublinCore::CREATOR, "John Doe");
$metaValue->addAttr("id", "something");
$metaValue->addAttr("xml:lang", "en");

$metaValue = new MetaValue("meta", "Doe, John");
$metaValue->addAttr("refines", "#something");
$metaValue->addAttr("property", "file-as");

It's not pretty, and I'll have a look to see if I can improve it. Especially as currently DublinCore and MetaValue data are in the same array, though the dc: namespace is only added top the DublinCore objects.

  3. Re: OPF metadata properties   Reply   Report abuse  
Callum West - 2015-11-14 19:26:39 - In reply to message 2 from Asbjorn Grandt
@Asbjorn many thanks for the quick reply. I see now how to do it, thank you for that. :)


For more information send a message to info at phpclasses dot org.