PDA

View Full Version : RSS feed in main.tpl file using Carp


DelMarSurf
06-05-2006, 04:32 PM
I want to display some rss feeds on the main page of a directory using the rss to html parser Carp.

I thought I could just add some Handlers: .tpl -> application/x-httpd-php and place the Carp code:

<?php
require_once '/home/puppythr/carp/carp.php';
// Add any desired configuration settings below this line using "CarpConf" and other functions - ARTICLES FEED
CarpConf('cborder','');
CarpConf('iorder','link,date,desc');
CarpConf('bitems','<ul>');
CarpConf('aitems','</ul>');
CarpConf('maxidesc',200);
CarpConf('atruncidesc','...read more');
CarpConf('bi','<li>');
CarpConf('ai','</li>');
CarpConf('maxitems',5);
CarpConf('poweredby','');
CarpCacheShow('http://puppythrill.com/blog/xmlsrv/rss2.php?blog=3');
?>

On the page. All I get is a display of the code. I found Jim Westergrens example at: http://www.jimwestergren.com/tutorial-rss-feed-inside-smarty-template-files/

Carp already takes care of the DB side. Any ideas?

DEL

proprod
06-06-2006, 05:26 AM
Content visible to registered users only.

Try replacing the <?php and ?> with {php} and {/php} - That may do the trick for you. :D

anon
06-06-2006, 06:01 AM
require_once ('/home/puppythr/carp/carp.php');

should go in your index.php (put in under the require_once('init.php'); for good measure)

the rest, ecase it in {php} all of your carp code in here {/php}

DelMarSurf
06-10-2006, 11:42 AM
Content visible to registered users only.

OK - The articles parse perfectly, but now the rest of the site is fubar.

INDEX.php

require_once 'init.php';
require_once '/home/puppythr/carp/carp.php';

MAIN.tpl

{php}
CarpConf('cborder','');
CarpConf('iorder','link,date,desc');
CarpConf('bitems','<ul>');
CarpConf('aitems','</ul>');
CarpConf('maxidesc',200);
CarpConf('atruncidesc','...read more');
CarpConf('bi','<li>');
CarpConf('ai','</li>');
CarpConf('maxitems',5);
CarpConf('poweredby','');
CarpCacheShow('http://puppythrill.com/blog/xmlsrv/rss2.php?blog=3');
?>{/php}

The site is just displaying code after the articles so I think it must be an easy fix.

http://www.puppythrill.com/

DelMarSurf
06-10-2006, 11:49 AM
Fixed it - saw the prob as soon as I pasted the code.