Page 1 of 1

Feed-Templates depending on the User-Agent?

Posted: Tue May 23, 2006 8:35 pm
by Boris
Hi everyone,

is there any way to make the Newsfeeds dependent on the HTTP-User-Agent?

Background: there are a few certain user-agents to whom I don't want to deliver the complete entries, but only headlines and/or teaser-texts.

Re: Feed-Templates depending on the User-Agent?

Posted: Wed May 24, 2006 1:40 pm
by garvinhicking
Yes, you can do that.

Write up a config.inc.php for your template, set

Code: Select all

<?php
$serendipity['smarty']->assign('user_agent', $_SERVER['HTTP_USER_AGENT']);
then in your feed*.tpl template you can use

Code: Select all

{if $user_agent == 'XXX'}
...
{else}
{/if}
Best regards,
Garvin

Re: Feed-Templates depending on the User-Agent?

Posted: Thu May 25, 2006 11:44 am
by Boris
Great. That sounds really easy. Thank you.