Recent Topics

1 Jul 24, 2008 01:53    

I know nobody uses trackbacks anymore, but I love them. So I was surprised when I tried to include trackback autodiscovery to my posts via trackback_rdf() in my Skin. The RDF output by this function is erroneous:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description
  rdf:about="http://liberal-venezolano.net/blog/2008/07/23/las-bases-rusas-que-creo-interfax"
  dc:identifier="http://liberal-venezolano.net/blog/2008/07/23/las-bases-rusas-que-creo-interfax"
------> <a href="http://liberal-venezolano.net/blog/2008/07/23/las-bases-rusas-que-creo-interfax">Las bases rusas que creó interfax</a>  trackback:ping="http://liberal-venezolano.net/blog/htsrv/trackback.php?tb_id=2094" />
</rdf:RDF>

Do you see the error? It is sending the complete link to the entry, instead of only the title, on line 7 (where the -----> is).

The problem is that trackback_rdf() uses still the old syntax for $Item->title().

The following patch solves the issue:

--- /home/lnieves/tmp/b2evolution/blog/inc/items/model/_item.class.php  2008-04-27 22:09:28.000000000 +0200
+++ inc/items/model/_item.class.php     2008-07-24 01:39:48.000000000 +0200
@@ -2345,7 +2345,10 @@
                echo '  dc:identifier="';
                $this->permanent_url( 'single' );
                echo '"'."\n";
-               $this->title( '  dc:title="', '"'."\n", false, 'xmlattr' );
+    $this->title( array( 'before' =>'  dc:title="',
+      'after' => '"'."\n",
+      'link_type' => 'none',
+      'format' => 'xmlattr' ) );
                echo '  trackback:ping="';
                $this->trackback_url();
                echo '" />'."\n";

which will do what it's supposed to do:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description
  rdf:about="http://liberal-venezolano.net/blog/2008/07/23/las-bases-rusas-que-creo-interfax"
  dc:identifier="http://liberal-venezolano.net/blog/2008/07/23/las-bases-rusas-que-creo-interfax"
  dc:title="Las bases rusas que creó interfax"
  trackback:ping="http://liberal-venezolano.net/blog/htsrv/trackback.php?tb_id=2094" />
</rdf:RDF>

Additional question On the comments at the beginning of trackback_rdf() it says:

* TODO: build into headers

But looking at [url=http://www.sixapart.com/pronet/docs/trackback_spec]Trackback technical specification[/url] I couldn't find anyplace where it says that trackback autodiscovery should go on the HTML headers. So the question is, What does that (quoted above) comment mean?

Almost forgot: The patch is against the 2.4.2 sources, not HEAD!

2 Jul 24, 2008 03:29

Trackback technical specification wrote:

Sample RDF looks like this:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description
rdf:about="http://www.foo.com/archive.html#foo"
dc:identifier="http://www.foo.com/archive.html#foo"
dc:title="Foo Bar"
trackback:ping="http://www.foo.com/tb.cgi/5" />
</rdf:RDF>

Great job. Thanks for sharing. Fixed in HEAD

3 Dec 05, 2008 12:01

This bug has come back in 2.4.5. SOlution is the same, of course.

4 Dec 06, 2008 15:07

Thanks, this bug is now also fixed in v-2-4. :)

Tblue

5 Jan 16, 2009 22:18

Hello.

I just ran across this feature and thread and I'm trying to add it to v.2.4.5. Here's the partial code I have in 'trackback_rdf()' in the file 'item.class.php':

EDIT: Offending code removed


		echo '<rdf:Description'."\n";
		echo '  rdf:about="';
		$this->permanent_url( 'single' );
		echo '"'."\n";
		echo '  dc:identifier="';
		$this->permanent_url( 'single' );
		echo '"'."\n";
// ADDED the next 4 lines to fix autodiscovery bug
		$this->title( array( 'before' =>'  dc:title="',
		'after' => '"'."\n",
		'link_type' => 'none',
		'format' => 'xmlattr' ) );
		echo '  trackback:ping="';
		$this->trackback_url();
		echo '" />'."\n";

Then I added this to the purple_beauty skin in 'index.main.php' to test it:

					// Link to comments, trackbacks, etc.:
					$Item->feedback_link( array(
									'type' => 'trackbacks',
									'link_before' => ' &bull; ',
									'link_after' => '',
									'link_text_zero' => T_('Leave a trackback'),
									'link_text_one' => T_('1 trackback'),
									'link_text_more' => T_('%d trackbacks'),
									'link_title' => '#',
									'use_popup' => false,
								) );

						$Item->trackback_rdf(); // trackback autodiscovery information

I'm getting the following error on the frontend:

EDIT: ERROR NOW GONE...

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /this/sub/dir/www/blogs/inc/items/model/_itemlight.class.php on line 707

An unexpected error has occured!

If this error persits, please report it to the administrator.

Go back to home page
Additional information about this error:
Output format [] not supported.

Do you have any idea what might be going on?

Thanks.

P.S. The blog subdir is currently password-protected until it goes live so not sure if this message is related to this.

EDIT: I found the error. I forgot to delete the old $this->title(...) line. It looks good. Thanks Austriaco et al.

Now, to figure out how other blog software is able find and use this code.

6 Jan 17, 2009 06:52

Hello again.

UPDATE: Previous post updated. Code error found and snippet works.

Thanks for the revision, Austriaco! ;)


Form is loading...