Page 1 of 1

embeded pingbacks?

Posted: Mon Oct 02, 2006 9:21 pm
by JohnnyC
In all of the Smarty templates, I notice a line in the header for pingbacks:

Code: Select all

{if $entry_id}
    <link rel="pingback" href="{$serendipityBaseURL}comment.php?type=pingback&entry_id={$entry_id}" />
{/if}
This section is left out when is_embedded is true. How can I handle this when Serendipity is embeded? Where does the $entry_id variable come from?

Re: embeded pingbacks?

Posted: Mon Oct 02, 2006 10:14 pm
by garvinhicking
Hi!

Yes, this <link> element is left out because in embedded mode, serendipity cannot take care of the HTML header.

The Smarty {$entry_id} variable would correspond to the PHP variable $serendipity['GET']['id'], which you can fetch and echo/display in your custom wrapper.php file or however you used it.

HTH,
Garvin

What if we're using PEAR?

Posted: Mon Oct 02, 2006 11:01 pm
by JohnnyC
Thanks for the details, garvinhicking. I had a look at the code that's getting the blog page in my embeded application, and it looks like it's using a PEAR HTTP_Request:

Code: Select all

        require_once 'HTTP/Request.php';
        $phpSelfParts = split('\?', $_SERVER['PHP_SELF']);
        $s9yUri = BASE_URL . '/serendipity/?'.@$phpSelfParts[1];
    	$req = &new HTTP_Request($s9yUri);
    	$req->sendRequest();
    	$output->blogData = $req->getResponseBody();
So, how would I access the $serendipty['get']['id'] variable? Would the ID be on the query string?

Re: What if we're using PEAR?

Posted: Mon Oct 02, 2006 11:50 pm
by garvinhicking
Hi!

Ooooh. That's a pretty bad way of embedding Serendipity. :-)

It performs an additional HTTP request and puts the result output into your app. That does not scale at all, and slows down the app by maybe 80%.

You should really use the embed method outlined in the s9y.org technical documentation, using PHP code includes!

With the method you are using, you cannot access any Serendipity variables at all. It won't work your way, I'm sorry. You only receive HTML as a "return", and thus you are completely shut off from any variables set within the serendipity run...

HTH,
Garvin

Sounds like a challenge!

Posted: Tue Oct 03, 2006 1:34 am
by JohnnyC
Can I quote you on that? :)

So is there any API that I could call which would expose the ID that I'm after to get this pingback to work? Alternately, is there an API that would pass me the headers that Serendipity would normally generate, so I can included them in my page?

Re: Sounds like a challenge!

Posted: Tue Oct 03, 2006 4:05 pm
by garvinhicking
Hi!

Yes, the Serendipity API would give you that through a simple variable: $serendipity['GET']['id']. But this is only available if, as mentioned, you embed your serendipity using include/require code calls, and not a HTTP call. HTTP calls are uni-directional; after it has been executed, no API can give you the state back.

Of could use XML-RPC for all that, but that is a huge pain in the behind. Including the s9y framework is the much more sane way. :)

HTH,
Garvin