Atom feed - Object list, wedoc_CreationDate, wedoc_ModDate

Michael_S
Senior Member
Beiträge: 160
Registriert: Mi 4. Feb 2004, 02:39
Wohnort: London / UK
Kontaktdaten:

Atom feed - Object list, wedoc_CreationDate, wedoc_ModDate

Beitragvon Michael_S » Mo 27. Jan 2014, 13:24

Hi,

I'm building a Atom feed and need to add the creation and modification date for a Object but "wedoc_CreationDate" and "wedoc_ModDate" are not working so I'm having to use wedoc_Published for the id and update element which is not ideal:

Code: Alles auswählen

<we:field type="date" name="wedoc_CreationDate" format="..." />
<we:field type="date" name="wedoc_ModDate" format="..." />


Code: Alles auswählen

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" >
  <title>...</title>
  <link href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/feed/atom.xml" rel="self" />
  <id>tag:<?php echo $_SERVER['SERVER_NAME']; ?>,2014-01-27:/feed/20140127101752262</id>
  <updated><we:date type="php" format="Y-m-d" />T<we:date type="php" format="H:i:sP" /></updated>
  <author>
    <name>...</name>
  </author>
  <we:listview type="object" name="Artist" order="Title" rows="10" desc="true" classid="1" order="wedoc_Published">
    <we:repeat>
      <entry>
        <title><![CDATA[<we:field type="text" name="Article_Title" />]]></title>
        <link href="http://<?php echo $_SERVER['SERVER_NAME']; ?><we:field name="we_path"/>" />
        <id>
          tag:<?php echo $_SERVER['SERVER_NAME']; ?>,<we:field type="date" name="wedoc_CreationDate" format="Y-m-d" />:/feed/
          <we:field type="date" name="wedoc_CreationDate" format="YmdHis" />
        </id>
        <updated>
          <we:field type="date" name="wedoc_ModDate" format="Y-m-d" />T
          <we:field type="date" name="wedoc_ModDate" format="H:i:sP" />
        </updated>
        <summary><we:field type="text" name="Article_Summary" /></summary>
        <media:thumbnail url="http://<?php echo $_SERVER['SERVER_NAME']; ?>
          <we:field type="img" name="Article_Thumb" only="src" />" width="220" height="220" />
      </entry>
    </we:repeat>
  </we:listview>
</feed>


Is there a workaround (php code) to print/echo the wedoc_creationDate and wedoc_ModDate?

Regards,

Michael.
Production Area
London, UK
http://productionarea.com

WBTMagnum
webEdition Partner
webEdition Partner
Beiträge: 1318
Registriert: Di 7. Mär 2006, 16:50
Kontaktdaten:

Re: Atom feed - Object list, wedoc_CreationDate, wedoc_ModDa

Beitragvon WBTMagnum » Mo 27. Jan 2014, 15:56

Hello Michael,

A quite hackish solution was posted here: viewtopic.php?p=36280#p36280

Maybe that's of some help.


JFTR, there is already a bunch of bugreports / feature requests regarding this problem:

Cheers,
Sascha

Michael_S
Senior Member
Beiträge: 160
Registriert: Mi 4. Feb 2004, 02:39
Wohnort: London / UK
Kontaktdaten:

Re: Atom feed - Object list, wedoc_CreationDate, wedoc_ModDa

Beitragvon Michael_S » Mo 27. Jan 2014, 16:33

Hi Sascha,

Thanks I will give it a try, the CreationDate and ModDate are crucial for feeds so it would be great to have this fixed soon.

Cheers,

Michael.
Production Area
London, UK
http://productionarea.com

Michael_S
Senior Member
Beiträge: 160
Registriert: Mi 4. Feb 2004, 02:39
Wohnort: London / UK
Kontaktdaten:

Re: Atom feed - Object list, wedoc_CreationDate, wedoc_ModDa

Beitragvon Michael_S » Mo 27. Jan 2014, 17:42

Hi Sascha,

WBTMagnum hat geschrieben:A quite hackish solution was posted here: viewtopic.php?p=36280#p36280


The posts solution outputs the same value as wedoc_Published which works as a we:tag:

Code: Alles auswählen

<we:field type="date" name="wedoc_Published" format="..." />


What I need is the output for wedoc_CreationDate and unfortunately adapting the example code to OF_CreationDate does not work:

Code: Alles auswählen

<we:field type="date" name="wedoc_CreationDate" />


Regards,

Michael.
Production Area
London, UK
http://productionarea.com

WBTMagnum
webEdition Partner
webEdition Partner
Beiträge: 1318
Registriert: Di 7. Mär 2006, 16:50
Kontaktdaten:

Re: Atom feed - Object list, wedoc_CreationDate, wedoc_ModDa

Beitragvon WBTMagnum » Di 28. Jan 2014, 00:30

Hi MIchael,

You are correct. Sorry for the misleading information.

I just had a look at the database's table structure. Seems like the field 'ModDate' and 'CreationDate' are stored in a different table (see tblObjectFiles).

I fiddled a bit with the SQL statements and came up with the following untested and still hackish solution:

Code: Alles auswählen

<we:listview type="object" classid="1">
  <we:repeat>
<?php
    $creationDate = f('SELECT CreationDate FROM ' . OBJECT_FILES_TABLE . ' WHERE ObjectID=`' . $lv->DB_WE->f('OF_ID') . '`, 'CreationDate', $DB_WE);
    $modificationDate = f('SELECT ModDate FROM ' . OBJECT_FILES_TABLE . ' WHERE ObjectID=`' . $lv->DB_WE->f('OF_ID') . '`, 'ModDate', $DB_WE);

    /* set date format */
    $creationDate = date("d.m.Y",$creationDate);
    $modificationDate = date("d.m.Y",$modificationDate);
    echo $creationDate . ' / ' . $modificationDate;
?>
  </we:repeat>
</we:listview>


You might want to give it a try. I'm aware that there is some room for optimization and the two f(...) calls should be combined. But frankly I haven't had the time to go any deeper into this issue.


Hope that helps,
Sascha

Michael_S
Senior Member
Beiträge: 160
Registriert: Mi 4. Feb 2004, 02:39
Wohnort: London / UK
Kontaktdaten:

Re: Atom feed - Object list, wedoc_CreationDate, wedoc_ModDa

Beitragvon Michael_S » Di 28. Jan 2014, 12:18

Hi Sascha,

I ended up with a slightly simpler solution:

Code: Alles auswählen

<?php

   // Object creation date

   $ObjectCreationDate = f("SELECT CreationDate FROM tblObjectFiles WHERE ID=" . $lv->DB_WE->f("OF_ID"));
   $ObjectCreationDate = date("l jS F Y H:i:s",$ObjectCreationDate);
   echo "<p>Creation Date: " . $ObjectCreationDate . "</p>";

   // Object mod date

   $ObjectModDate = f("SELECT ModDate FROM tblObjectFiles WHERE ID=" . $lv->DB_WE->f("OF_ID"));
   $ObjectModDate = date("l jS F Y H:i:s",$ObjectModDate);
   echo "<p>Mod Date: " . $ObjectModDate . "</p>";

?>

Thanks for you help.

Michael.
Production Area
London, UK
http://productionarea.com

WBTMagnum
webEdition Partner
webEdition Partner
Beiträge: 1318
Registriert: Di 7. Mär 2006, 16:50
Kontaktdaten:

Re: Atom feed - Object list, wedoc_CreationDate, wedoc_ModDa

Beitragvon WBTMagnum » Di 28. Jan 2014, 13:05

Hi Michael,

Glad it worked.

One last question:
Are you sure about the ... WHERE ID=" part? If I'm not mistaken you have to look for ObjectID.


Cheers,
Sascha

Michael_S
Senior Member
Beiträge: 160
Registriert: Mi 4. Feb 2004, 02:39
Wohnort: London / UK
Kontaktdaten:

Re: Atom feed - Object list, wedoc_CreationDate, wedoc_ModDa

Beitragvon Michael_S » Di 28. Jan 2014, 13:52

Hi Sascha,

The ID field has the correct value in the table tblObjectFiles, not sure what the ObjectID field relates to as its a completely different value? There are posts relating to this in the bug tracker where people have got odd results when using ObjectID.

Strangely my code works in 6.3.9.2 (SVN-Revision: 7222|main-develop) but not in 6.3.8.0 (SVN-Revision: 6985) official release.

Regards,

Michael.
Production Area
London, UK
http://productionarea.com

WBTMagnum
webEdition Partner
webEdition Partner
Beiträge: 1318
Registriert: Di 7. Mär 2006, 16:50
Kontaktdaten:

Re: Atom feed - Object list, wedoc_CreationDate, wedoc_ModDa

Beitragvon WBTMagnum » Di 28. Jan 2014, 14:07

Hello,

I just had another look at the table structure:
ObjectID is just a reference to the class related object tables (tblObject_1, tblObject_2, etc.). Those IDs are not unique, therefore the OF_ID (= ObjectFileID) is used.


Regarding your problem in Version 6.3.8.0:
What's happening, or not happening? Any info in the error log?


Cheers,
Sascha

Michael_S
Senior Member
Beiträge: 160
Registriert: Mi 4. Feb 2004, 02:39
Wohnort: London / UK
Kontaktdaten:

Re: Atom feed - Object list, wedoc_CreationDate, wedoc_ModDa

Beitragvon Michael_S » Di 28. Jan 2014, 14:26

WBTMagnum hat geschrieben:Regarding your problem in Version 6.3.8.0:
What's happening, or not happening? Any info in the error log?


My mistake with the versions, one was a document listview which we know works.

Regarding the ID and ObjectID I can see that this would be a problem. The tblObjectFiles > ObjectID is used as the tblObject_# > ID so I assume the long term solution would be to add the CreationDate and ModDate fields to the tblObject_#.

Regards,

Michael.
Production Area
London, UK
http://productionarea.com


Zurück zu „webEdition Basic Version“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast