Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Pictures in rss?  (Read 2898 times)

sibas

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 451
    • www.simply4all.net
Pictures in rss?
« on: July 03, 2007, 01:04:03 pm »

Hi, I look to find a way to display pictures to rss.
I try this but no picture in rss

Code: [Select]
Any idea about?
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Pictures in rss?
« Reply #1 on: July 03, 2007, 01:30:40 pm »

First a sidenote, the images MUST be GIF, JPEG or PNG, nothing else will do.

Ok, I'm no RSS pro in any way, but I know that what you tried will not work... the tag for image in an RSS document is:
Quote

and inside this there will have to go three other tags:
Quote
URL to IMAGE
  Title if no image is showing
  and the actual link to the website that offers the feed
So somewhere inside function RSS() (in the snews.php) changes must be made and the only thing I'm certain of is that the $item's must be added:
Quote
$item  .= '';
Quote
$item  .= '';
I would think that we also somehow need to add the $item for (these are required):
Quote
$item  = ' ';
 $item . = '
';
$item  .= '   ';<br />$item  .= ' ';
$item  .= '   ';
$item  .= ' ';
(and perhaps these optional tags:
Quote


)
what happens next is a tad cloudy to me, hehe... we need to get the actual image URL, Title and Link from somewhere and add it to the RSS, and this beats the hell out of me... specially as there already are $item title and link  for the specific items added...

Mhmm..

To me it's the PHP behind it all that messes with my mind, hehe... 'Coz if I try a handmade RSS, like this:
Quote




  Rödsle BK P-96
  http://p-ahlqvist.com/rbk96/gallery/
  Sexiest underware around - sNews integrated Zenphoto
 
    http://p-ahlqvist.com/examples/go_sweden.jpg
    Tjolahoops
    http://p-ahlqvist.com/rbk96/gallery/
 
 
    News, sexy news on p-ahlqvist.com
    http://p-ahlqvist.com/rbk96/rss-articles/
    Add this feed to your reader
 


then it works including an image... but with the function rss() inside snews.php, I just don't have the knowledge... Perhaps someone with greater skills than me might add this feature ???
Logged
"It's only dead fish that goes with the flow... "
Updated

rustyvz

  • Newbie
  • *
  • Karma: 0
  • Posts: 6
Pictures in rss?
« Reply #2 on: July 03, 2007, 07:08:30 pm »

Hello, first post and all here...

Quote
$item  = '';
You have many lines in your example like this. I believe they should have a period in front of the equal sign, like so:

Quote
$item  .= '';
That will allow them to be concatenated together.

Just want to make sure others do not get confused if the code does not work for them.

Thanks!
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Pictures in rss?
« Reply #3 on: July 04, 2007, 08:00:20 am »

Hi and welcome, rustyvz ;) Thanks, I've changed that.
Logged
"It's only dead fish that goes with the flow... "
Updated

sibas

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 451
    • www.simply4all.net
Pictures in rss?
« Reply #4 on: July 04, 2007, 12:59:05 pm »

Thank you Patric & rustyvz for your reply,
but iam totaly noob  with snews, Patric you say inside RSS() function can you pls tell me where try to add those new $item

Code: [Select]
// RSS FEED - ARTICLES/PAGES/COMMENTS
function rss_contents($rss_item, $artSEF=''){
header('Content-type: text/xml; charset='.s('charset').'');
$limit = s('rss_limit');
switch($rss_item) {
case 'rss-articles':
$heading = l('articles');
$query = "articles WHERE position = 1 AND published = 1 ORDER BY date";
break;
case 'rss-pages':
$heading = l('pages');
$query = "articles WHERE position = 3 AND published = 1 ORDER BY date";
break;
case 'rss-comments':
$heading = l('comments');
$artId = retrieve('id','articles','seftitle',$artSEF);
$articleId = ($artId && is_numeric($artId)) ? "AND articleid = $artId" : '';
$query = "comments WHERE approved = 'True' $articleId ORDER BY id";
break;
}
$header = '';
$header .= '';
    $header .= '';
    $header .= '<![CDATA['.s('website_title').']]>';
    $header .= '';
    $header .= ''.db('website').'';
    $header .= '';
    $header .= 'sNews CMS';
    $footer = '
';
    $footer .= '
';
echo $header;
$result = mysql_query("SELECT * FROM ".db('prefix')."$query DESC LIMIT $limit");
$numrows = mysql_num_rows($result);
$comments_order = s('comments_order');
$ordinal = $comments_order == 'DESC' ? 1 : $numrows;
$comment_limit = s('comment_limit') < 1 ? 1 : s('comment_limit');
$comments_order = s('comments_order');
while ($r = mysql_fetch_assoc($result)) {
switch($rss_item) {
case 'rss-articles':
case 'rss-pages':
$date = date('D, d M Y H:i:s +0000', strtotime($r['date']));
$categorySEF = find_cat_sef($r['category']);
$articleSEF = $r['seftitle'];
$title = $r['title'];
$text = $r['text'];
break;
case 'rss-comments';
$subquery = "SELECT * FROM ".db('prefix')."comments WHERE articleid = $r[articleid] ORDER BY id $comments_order";
$subresult = mysql_query($subquery);
$num = 1;
while ($subr = mysql_fetch_array($subresult)) {
if ($subr['id'] == $r['id']) {$ordinal = $num;}
$num++;
}
$page = ceil($ordinal / $comment_limit);
$articleSEF = retrieve('seftitle', 'articles', 'id', $r['articleid']);
$articleCat = retrieve('category', 'articles', 'seftitle', $articleSEF);
$articleTitle = retrieve('title', 'articles', 'id', $r['articleid']);
$categorySEF = find_cat_sef($articleCat);
if (!empty($articleSEF)) {
$paging = $page > 1 ? $page.'/' : '';
$comment_link = $paging.'#'.l('comment').$ordinal;
}
$date = date('D, d M Y H:i:s +0000', strtotime($r['time']));
$title = $articleTitle.' - '.$r['name'];
$text = $r['comment'];
break;
}
$link = db('website').$categorySEF.'/'.$articleSEF.'/'.$comment_link;
$item  = '';
$item .= '<![CDATA['.strip($title).']]>';
$item .= '';
$item .= ''.$date.'';
$item .= ''.$link.'';
$item .= ''.$link.'';
$item .= '
';
echo $item;
}
echo $footer;
exit;
}
What if from
Code: [Select]
$item .= '';remove .strip($text). ?
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Pictures in rss?
« Reply #5 on: July 04, 2007, 01:05:24 pm »

Quote
...but iam totaly noob  with snews, Patric you say inside RSS() function can you pls tell me where try to add those new $item...
No, I'm sorry, I can't tell you where, as I stated in my first post (last line). I don't possess the knowledge either, therefor my question to others about possibly giving us help with this...
Logged
"It's only dead fish that goes with the flow... "
Updated

sibas

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 451
    • www.simply4all.net
Pictures in rss?
« Reply #6 on: July 04, 2007, 01:46:13 pm »

OK  :D
I give a try as soon install a new snews for testing,
until then if anyone have any idea of how to do this it will be very helpful.
Logged