Announcement

  •  » Engine
  •  » [resolved] Rss

#1 2012-11-20 10:29:34

EvilKant
Member
Russia
1970-01-01
98

[resolved] Rss

I write RSS feed for my Evil_Blog. Last version you can find in SVN. I never use RSS before and don't know how that must working correctly, but I already have problems with links to posts.

Code:

include_once(PHPWG_ROOT_PATH.'include/feedcreator.class.php');
  $rss = new UniversalFeedCreator();
  $rss->encoding=get_pwg_charset();
  $rss->title = $conf['gallery_title'];
  $rss->link = get_root_url().'?/blog';
  $rss->description = $page['evil_blog']['blog_description'];
  
  
  $result = pwg_query("
    SELECT id, UNIX_TIMESTAMP(date) AS date, header, text
    FROM `".Evil_Blog_Table."`
    WHERE 1
    ORDER BY `date` DESC
  ");
  while ($row = pwg_db_fetch_assoc($result)) {
    $item = new FeedItem();
    $item->title = $row['header'].' '.date($page['evil_blog']['date_format'], $row['date']);
    $item->link = get_gallery_home_url().'?/blog/id/'.$row['id'];
    $item->description = $row['text'];
    $item->date = $row['date'];
    $item->descriptionHtmlSyndicated = true;
    $item->guid= sprintf('%s', $row['date']);
    $rss->addItem($item);
  }
  
  $fileName= PHPWG_ROOT_PATH.$conf['data_location'].'tmp';
  mkgetdir($fileName); // just in case
  $fileName.='/evil_blog_feed.xml';
  // send XML feed
  echo $rss->saveFeed('RSS2.0', $fileName, true);

My firefox can see each post, but can't get link to each post, it send me only to main rss link ($rss->link = get_root_url().'?/blog';). And on rss page titles don't have links. I do all like in your piwigo's code, but I don't understand what I do wrong. All looks like line $item->link = get_gallery_home_url().'?/blog/id/'.$row['id']; doing nothing.

PS. Released versions of Evil_Blog don't have different pages for each post. I download in SNV new version where each post has its own page.

Last edited by EvilKant (2012-11-20 10:33:01)

Offline

 

#2 2012-11-20 11:56:00

flop25
Piwigo Team
2006-07-06
7037

Re: [resolved] Rss

unfortunately the whole feedcreator class is quite old.

In your rss, there is no <link>?


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#3 2012-11-20 13:05:53

EvilKant
Member
Russia
1970-01-01
98

Re: [resolved] Rss

Lol... I don't know what was that, but now all working. I think I was must restart firefox.

Offline

 
  •  » Engine
  •  » [resolved] Rss

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2022 · Contact