| Author |
Message |
kashyyyk Member
|
Posted: 23 Feb 2006 19:40:47
I use to use carps rss news feed reader in my old website. I want to add the news feeds again. I use to use server side includes -
<!--#include virtual="newsIGNrss.php"--> which I had to save my old site as .shtml. How do I use the server side includes in tpl templates. I tried it and it didn't work. Below is the php code called.
<?php
require_once '/home/allabou/carp/carp.php';
CarpConf('iorder','link,date,desc');
CarpConf('bidesc','<font size="1px">');
CarpConf('aidesc','</font>');
CarpConf('bilink','<font size="2px">');
CarpConf('ailink','</font><br>');
CarpConf('descriptiontags','b|/b|i|/i');
CarpConf('maxidesc',100);
CarpConf('bitems','<table bgcolor="silver" width="220"><tr><Td><ul>');
CarpConf('aitems','</ul></td></tr></table>');
CarpConf('bi','<li>');
CarpConf('ai','</li>');
CarpConf('maxitems',5);
CarpConf(' linktarget ','1');
CarpConf('atruncidesc','...');
CarpCacheShow('http://www.geckotribe.com/press/rss/pr.rss');
?>
-or-
I see you use RSS news feed to add the news to our control panel page. Is there a way to use the news feed system already in the script to add news feeds into the site?
Dan
|
Anonymous
|
Posted: 3 Mar 2006 02:16:56
I use carp and java script to display rss feeds, Actually I was thinking of adding the industrial hemp feed to the white area that was talked about in an earlier message here on the board. yuou know about carp but if you go to http://jade.mcli.dist.maricopa.edu/feed/index.php?s=build and type in the link to the script it will build you a little java script to paste in. Now once you do that you may want to go to http://www.tc-sales.biz/article/ and check out the feeds there. Some good some not so good but We try..heheheheh...hope this helps a little.
|
Anonymous
|
Posted: 3 Mar 2006 02:18:21
Anonymous
|
treasure
|
Posted: 3 Mar 2006 02:20:19
not sure why I didnt log in but anyway the messages above were mine
|
kashyyyk Member
|
Posted: 3 Mar 2006 17:59:14
I use carps javascript to get them on my site for now, but the feed text is not part of the site it appears as the javascript code. For word count, if I can get the feed on my site it will help with keywords.
|
treasure
|
Posted: 3 Mar 2006 23:01:44
Awwww Got it. Hey if you figure that one out please post it here...I think I would like that idea..hehehehe
|
kashyyyk Member
|
Posted: 4 Mar 2006 11:11:36
I got it to work in a way. I can't limit the number shown on the page, or when there are images, to get them to show.
But here is what I did. and how it looks on the page-
http://www.game-searcher.com/newsrss.php
I added my feeds to the header php
$_skalinks_url['ign_news'] = 'http://scripts.ign.com/rss/ign.all.2.0.xml';
$_skalinks_url['gamespy_news'] = 'http://scripts.gamespy.com/rss/gamespy.all.2.0.xml';
$_skalinks_url['teamxbox_news'] = 'http://rss.teamxbox.com/news/latest.rss';
$_skalinks_url['3dgamer_news'] = 'http://www.3dgamers.com/news/3dgamers.rss';
###############
I made a newsrss.php and put this on it-
<?php
require_once( 'headers.php' );
$SkaLinks = new SkaLinks( $_skalinks_mysql );
$smarty = new DirSmarty();
$SkaLinks->SetRootURL( $_skalinks_url['dir'] );
$SkaLinks->SetPrefix( $_skalinks_mysql['tbl_prefix'] );
$_output['title'] = $SkaLinks->GetTitleChain( -1, $_skalinks_page['title'], $_skalinks_page['title_newsrss'] );
$ADMIN = $SkaLinks->IsAdmin();
require_once( 'SkaLinks_include/rss.class.php' );
$reader = new RSSReader( $_skalinks_url['ign_news'] );
foreach( $reader->data['item']['title'] as $key => $value )
{
$reader->data['item']['description'][$key] = str_replace( ">", ">", $reader->data['item']['description'][$key] );
$reader->data['item']['description'][$key] = str_replace( "<", "<", $reader->data['item']['description'][$key] );
$reader->data['item']['title'][$key] = str_replace( ">", ">", $reader->data['item']['title'][$key] );
$reader->data['item']['title'][$key] = str_replace( "<", "<", $reader->data['item']['title'][$key] );
$_output['news'][$key]['title'] = $reader->data['item']['title'][$key];
$_output['news'][$key]['link'] = $reader->data['item']['link'][$key];
$_output['news'][$key]['description'] = $reader->data['item']['description'][$key];
$_output['news'][$key]['pubdate'] = $reader->data['item']['pubdate'][$key];
}
require_once( 'SkaLinks_include/rss.class.php' );
$gsreader = new RSSReader( $_skalinks_url['gamespy_news'] );
foreach( $gsreader->data['item']['title'] as $gskey => $value )
{
$gsreader->data['item']['description'][$gskey] = str_replace( ">", ">", $gsreader->data['item']['description'][$gskey] );
$gsreader->data['item']['description'][$gskey] = str_replace( "<", "<", $gsreader->data['item']['description'][$gskey] );
$gsreader->data['item']['title'][$gskey] = str_replace( ">", ">", $gsreader->data['item']['title'][$gskey] );
$gsreader->data['item']['title'][$gskey] = str_replace( "<", "<", $gsreader->data['item']['title'][$gskey] );
$_output['gsnews'][$gskey]['title'] = $gsreader->data['item']['title'][$gskey];
$_output['gsnews'][$gskey]['link'] = $gsreader->data['item']['link'][$gskey];
$_output['gsnews'][$gskey]['description'] = $gsreader->data['item']['description'][$gskey];
$_output['gsnews'][$gskey]['pubdate'] = $gsreader->data['item']['pubdate'][$gskey];
}
require_once( 'SkaLinks_include/rss.class.php' );
$txreader = new RSSReader( $_skalinks_url['teamxbox_news'] );
foreach( $txreader->data['item']['title'] as $txkey => $value )
{
$txreader->data['item']['description'][$txkey] = str_replace( ">", ">", $txreader->data['item']['description'][$txkey] );
$txreader->data['item']['description'][$txkey] = str_replace( "<", "<", $txreader->data['item']['description'][$txkey] );
$txreader->data['item']['title'][$txkey] = str_replace( ">", ">", $txreader->data['item']['title'][$txkey] );
$txreader->data['item']['title'][$txkey] = str_replace( "<", "<", $txreader->data['item']['title'][$txkey] );
$_output['txnews'][$txkey]['title'] = $txreader->data['item']['title'][$txkey];
$_output['txnews'][$txkey]['link'] = $txreader->data['item']['link'][$txkey];
$_output['txnews'][$txkey]['description'] = $txreader->data['item']['description'][$txkey];
$_output['txnews'][$txkey]['pubdate'] = $txreader->data['item']['pubdate'][$txkey];
}
require_once( 'SkaLinks_include/rss.class.php' );
$tdreader = new RSSReader( $_skalinks_url['3dgamer_news'] );
foreach( $tdreader->data['item']['title'] as $tdkey => $value )
{
$tdreader->data['item']['description'][$tdkey] = str_replace( ">", ">", $tdreader->data['item']['description'][$tdkey] );
$tdreader->data['item']['description'][$tdkey] = str_replace( "<", "<", $tdreader->data['item']['description'][$tdkey] );
$tdreader->data['item']['title'][$tdkey] = str_replace( ">", ">", $tdreader->data['item']['title'][$tdkey] );
$tdreader->data['item']['title'][$tdkey] = str_replace( "<", "<", $tdreader->data['item']['title'][$tdkey] );
$_output['tdnews'][$tdkey]['title'] = $tdreader->data['item']['title'][$tdkey];
$_output['tdnews'][$tdkey]['link'] = $tdreader->data['item']['link'][$tdkey];
$_output['tdnews'][$tdkey]['description'] = $tdreader->data['item']['description'][$tdkey];
$_output['tdnews'][$tdkey]['pubdate'] = $tdreader->data['item']['pubdate'][$tdkey];
$_output['tdnews'][$tdkey]['image'] = $tdreader->data['item']['url'][$tdkey];
}
display( 'newsrss' );
?>
################
Then I made a newsrss.tpl
{include file='header.tpl'}
<table >
<tr><td width="50%" bgcolor="#C0C0C0" valign="top">
<h2><a href="http://www.ign.com/" target="new">IGN complete</a></h2>
{foreach item=news from=$_output.news}
<b><a href="{$news.link}" target="new">{$news.title}</a></b><br>
{$news.pubdate}<br>
{$news.description}<p>
{/foreach}
</td><td width="50%" valign="top">
<h2><a href="http://www.gamespy.com/" target="new">GameSpy complete</a></h2>
{foreach item=gsnews from=$_output.gsnews}
<b><a href="{$gsnews.link}" target="new">{$gsnews.title}</a></b><br>
{$gsnews.pubdate}<br>
{$gsnews.description}<p>
{/foreach}
</td></tr><tr><td width="50%" valign="top">
<h2><a href="http://www.teamXbox.com/" target="new">www.TeamXbox.com</a></h2>
{foreach item=txnews from=$_output.txnews}
<b><a href="{$txnews.link}" target="new">{$txnew
|
kashyyyk Member
|
Posted: 4 Mar 2006 11:14:38
Here is the rest of it, plus the last line again. The post was to long
<b><a href="{$txnews.link}" target="new">{$txnews.title}</a></b><br>
{$txnews.pubdate}<br>
{$txnews.description}<p>
{/foreach}
</td><td width="50%" valign="top" bgcolor="#C0C0C0">
<h2><a href="http://www.3dgamers.com/" target="new">3D Gamers</a></h2>
{foreach item=tdnews from=$_output.tdnews}
<b><a href="{$tdnews.link}" target="new">{$tdnews.title}</a></b><br>
{$tdnews.pubdate}<br>
{$tdnews.description}<p>
{/foreach}
</td></tr>
</table>
{include file='footer.tpl'}
########
I want to be able to limit the number of feeds shown, and use it with my News section topic and get certain feeds to show for certain catagories visited.
Dan
|
treasure
|
Posted: 6 Mar 2006 00:03:58
Oh man,
Way above my head...But thank you. I will copy and save it though incase sometime I get better at this stuff...
|
kashyyyk Member
|
Posted: 9 Mar 2006 17:52:06
Looking at my code, does anyone know how to limit the number of feeds shown.
Dan
|
skalinks Admin
|
Posted: 19 Apr 2006 23:49:35
The easiest way to do it, this:
in you code find part of code:
{foreach item=tdnews from=$_output.tdnews}
<b><a href="{$tdnews.link}" target="new">{$tdnews.title}</a></b><br>
{$tdnews.pubdate}<br>
{$tdnews.description}<p>
{/foreach}
and replace it with
{foreach item=tdnews from=$_output.tdnews name=custom_news}
{if $smarty.foreach.custom_news < 4}
<b><a href="{$tdnews.link}" target="new">{$tdnews.title}</a></b><br>
{$tdnews.pubdate}<br>
{$tdnews.description}<p>
{/if}
{/foreach}
Try it.
|
|