View Thread
 Print Thread
The woes of RSS
Homdax
Craig, Hien and I worked a bit on RSS feeds generated by a Drupal site, but we never got it working properly. There were several issues:
  1. somehow the Drupal RSS management was not standard
  2. creating layouts with images became a major headache
  3. implementing it in a fusion theme with a squarish tabularized layout with DIV turned out to be complex


Since the site is for my local political association it is pretty important to me to get this to work. I had a lengthy thread on main but once I got some chats going with Craig, and a bit with Hien, that quickly became obsolete.

I have no one else to rely on for code help but the PHP-Fusion community but that is fine and it usually serves everyone well since we share all solutions.

RSS sources:
http://www.modera...s/news.xml
http://www.modera.../press.xml
http://www.modera...s/news.xml

Target layout, as it was some months ago:
www.eslovsmoderaterna.se/forum/attachments/2014-01-16_14-42-04.png

Code by Hien and some comments on its implementation:

Quote

Quote


[16-January-2014 11:08] Hien: done
[16-January-2014 11:08] Hien: i'll pass you the function
[16-January-2014 11:08] Hien:

 function fusion_photocopier($url, $items=5) { 
 
    $html = "";
    $xml = simplexml_load_file($url);
 
    $i = 0;
    for($i=0; $i<=$items; $i++) {
 
        $title = utf8_decode($xml->channel->item[$i]->title);
        $link = utf8_decode($xml->channel->item[$i]->link);
        $news = utf8_decode($xml->channel->item[$i]->description);
        $date = utf8_decode($xml->channel->item[$i]->pubDate);
 
        $html .= "

$title
$date

\n";
        $html .= "

$news

\n";
 
    }
 
    return $html;
}

[16-January-2014 11:09] Hien: get that first
[16-January-2014 11:09] Hien: ah wait. better I code you a panel.. lol
[16-January-2014 11:10] Hien: nvm.
[16-January-2014 11:10] Hien: that is the function
[16-January-2014 11:11] Hien: Just copy and paste it to anywhere underneath maincore.php or something.. before ?>
[16-January-2014 11:11] Hien: To use the function:
[16-January-2014 11:11] Hien:

$url = "http://www.moderat.se/feeds/news.xml"; 
echo fusion_photocopier($url, 5);

[16-January-2014 11:11] Hien: 5 is the news count
[16-January-2014 11:12] Ainz: got that
[16-January-2014 11:12] Hien: try
[16-January-2014 11:12] Hien: Craig is right in the certain portion.
[16-January-2014 11:12] Hien: The Pic is embedded together with the news
[16-January-2014 11:12] Hien: To access and grab the pic out, you need to use DOM Parser.
[16-January-2014 11:13] Hien: Google for PHP Dom Parser. Ask Craig to read and implement for you.
[16-January-2014 11:13] Hien: It's just a walk in a park for him.
[16-January-2014 11:13] Ainz: ok, I got that, pasting it into a CP
[16-January-2014 11:14] Ainz: omg
[16-January-2014 11:14] Hien: The function cannot be in a panel ok. It will get fatal error.
[16-January-2014 11:14] Hien: ok :)
[16-January-2014 11:14] Hien: Can?
[16-January-2014 11:14] Ainz: http://www.eslovs...page_id=13
[16-January-2014 11:14] Hien: Ok done
[16-January-2014 11:14] Hien: :)
[16-January-2014 11:15] Ainz: some styling and shit and the dom parser
[16-January-2014 11:15] Hien: Yep.
[16-January-2014 11:15] Hien: Ok, I'll delete the codes off 8's.. lol
[16-January-2014 11:16] Hien: This is the parser: http://simplehtml...manual.htm
[16-January-2014 11:16] Hien: Download, install properely
[16-January-2014 11:16] Ainz: Il get back to you on the stuff we sort out and if it is enough... Got people on my back looking for a "look" and they just see how it can look and I try to sort out what can "work".
[16-January-2014 11:16] Hien: Ask Craig help you on the install. You need to require_once "path_to_parser";
[16-January-2014 11:16] Hien: in maincore.php
Then accessing the image can be done. Ask him to read the manual on the links I sent you.


// Find all element which id=foo 
$ret = $html->find('#foo');
 
// Find all element which class=foo
$ret = $html->find('.foo');
 
// Find all element has attribute id
$ret = $html->find('*[id]');
 
// Find all anchors and images
$ret = $html->find('a, img');


[16-January-2014 11:17] Hien: The parser can select anything and return the object as $ret
[16-January-2014 11:17] Hien: or any string
[16-January-2014 11:17] Hien: very powerful tool



So why do post this here? Well, two things: layout implementation in current v 7 themes, how can we handle that easier, and, some kind of RSS parser with layout controls. Both may be good ideas for relevant addons. If possible to do them.
...just one among some friends...
 
NetriX
Wouldn't it just be easier to generate the feed with PHP and SQL?

Then alter the php header.

I did that in the past and it always worked well, or perhaps I'm missing the purpose entirely. (It's 5 AM here) Ok...
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the [url=https://php-fusion.co.uk/articles.php?cat_
 
https://netrixhosting.com
Homdax
Good morning, dear NetriX, Wink

Did I forget to mention that the feed is external? My site lies on www.eslovsmoderat... .. seems I forgot to mention that.
...just one among some friends...
 
skpacman
That reminds me, I need to re-enable my cron-based RSS reader/poster for main's news feed...
Edited by skpacman on 11-04-2014 12:50

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
http://www.skpacman.com
Homdax
He...

So basically i am thinking adding the rss to a tabular view, to begin with. Then mess with DIV. All in the same UC panel.

Hmm, where did i put the working script?
...just one among some friends...
 
Homdax
I was thinking, perhaps your RSS reader can help, SkPacman?

Got several samples done, I will make some views available publicly.


 function fusion_photocopier($url, $items=5) { 
 
    $html = "";
    $xml = simplexml_load_file($url);
 
    $i = 0;
    for($i=0; $i<=$items; $i++) {
 
        $title = utf8_decode($xml->channel->item[$i]->title);
        $link = utf8_decode($xml->channel->item[$i]->link);
        $news = utf8_decode($xml->channel->item[$i]->description);
        $date = utf8_decode($xml->channel->item[$i]->pubDate);
 
        $html .= "

$title
$date

\n";
        $html .= "

$news

\n";
 
    }
 
    return $html;
}
echo "

Nyhetsfl?de fr?n Moderat.se

";

// Define number of feed items in line 3 (url, NUMBER)

opentable("

Nyheter

");
$url = "http://www.moderat.se/feeds/news.xml";
echo fusion_photocopier($url, 5);
closetable();

opentable("

Politik

");
$url = "http://www.moderat.se/feeds/politics.xml";
echo fusion_photocopier($url, 15);
closetable();

opentable("

Press

");
$url = "http://www.moderat.se/feeds/press.xml";
echo fusion_photocopier($url, 5);
closetable();





echo "
\n";
echo "
\n";
openside("Nyheter");
 $items_in_feed ="5";
$url = "http://www.moderat.se/feeds/news.xml";
$xml = simplexml_load_file($url);

$feed_title = $xml->channel->title;
$feed_link = $xml->channel->link;
$item = $xml->channel->item;

for ($i = 0; $i <  $items_in_feed; $i+++5) {
 
$article_title = $item[$i]->title;
$article_link = $item[$i]->link;

echo THEME_BULLET." ". utf8_decode(trimlink($article_title, 22)). "
";
}
closeside();

echo "
\n
\n";

openside("Press");
   $url = "http://www.moderat.se/feeds/press.xml";
$items_in_feed = 5;
$xml = simplexml_load_file($url);

$feed_title = $xml->channel->title;
$feed_link = $xml->channel->link;
$item = $xml->channel->item;

for ($i = 0; $i <  $items_in_feed; $i++) {
 
$article_title = $item[$i]->title;
$article_link = $item[$i]->link;

echo THEME_BULLET." ". utf8_decode(trimlink($article_title, 22)). "
";
}
closeside();

echo "
\n
\n";

openside("Politik");

$url = "http://www.moderat.se/feeds/politics.xml";
$items_in_feed = 5;
$xml = simplexml_load_file($url);

$feed_title = $xml->channel->title;
$feed_link = $xml->channel->link;
$item = $xml->channel->item;

for ($i = 0; $i <  $items_in_feed; $i+++5) {
 
$article_title = $item[$i]->title;
$article_link = $item[$i]->link;

echo THEME_BULLET." ". utf8_decode(trimlink($article_title, 22)). "
";
}
closeside();

echo "
\n
\n";

...just one among some friends...
 
skpacman
All my rss reader does is read the rss .xml feed, parses it into an array, then for each item in the array, checks it against criteria I set to make decisions whether to post the rss item in our local news feed. See below for full code.



/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: pfuk_rss_to_news.php
+--------------------------------------------------------+
| Written/edited by skpacman, idea by Gillette, original code
| found on http://stackoverflow.com/questions/2454979
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/

require_once "../maincore.php";

$rss_tags = array( 
'title', 
'link', 
'description', 
'pubDate',   
); 

function rss_to_array($tag, $array, $url) { 
  $doc = new DOMdocument(); 
  $doc->load($url); 
  $rss_array = array(); 
  $items = array(); 
  foreach($doc-> getElementsByTagName($tag) AS $node) { 
    foreach($array AS $key => $value) { 
      $items[$value] = $node->getElementsByTagName($value)->item(0)->nodeValue; 
    } 
    array_push($rss_array, $items); 
  } 
  return $rss_array; 
}

$rss_item_tag = 'item'; 
$rss_url = 'http://www.php-fusion.co.uk/rss.php';

$rssfeed = rss_to_array($rss_item_tag, $rss_tags, $rss_url);

foreach ($rssfeed as $item){
   $pubDate = strtotime($item['pubDate']);
   $diff = time() - $pubDate;
   $cutoff = 3600; //seconds
   //Check if posted less than an hour ago
   if ($diff < $cutoff){
      //Check if already posted to DB
      $posted = dbrows(dbquery("SELECT * FROM ".DB_NEWS." WHERE news_subject = '[RSS] ".$item['title']."'"));
      if (!$posted){
         $post = dbquery("INSERT INTO ".DB_NEWS." (news_subject, news_cat, news_news, news_name, news_datestamp, news_visibility, news_allow_comments, news_allow_ratings)
         VALUES ('[RSS] ".$item['title']."', '12',
         'Posted on PHP-Fusion.co.uk (main) on ".$item['pubDate']."

".addslashes($item['description'])."

See the full text at PHP-Fusion.co.uk', '2', '".time()."', '0', '1', '1')");
         if ($post){ echo "Posted \"[RSS] ".$item['title']."\"

"; }
      }   
      else {
         echo "Didn't post \"[RSS] ".$item['title']."\" because it has already been posted.

";
      }
   }
   else {
      echo "Didn't post \"[RSS] ".$item['title']."\" because the post is older than an hour.

";
   }

}

?>


There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
http://www.skpacman.com
Homdax
[19:02:00] Richard rikardmalmborg.se: rss-feed-full-single-column-hien.php

Alll feeds in one row, almost unformatted.

Code as below:



function fusion_photocopier($url, $items=5) { 
 
    $html = "";
    $xml = simplexml_load_file($url);
 
    $i = 0;
    for($i=0; $i<=$items; $i++) {
 
        $title = utf8_decode($xml->channel->item[$i]->title);
        $link = utf8_decode($xml->channel->item[$i]->link);
        $news = utf8_decode($xml->channel->item[$i]->description);
        $date = utf8_decode($xml->channel->item[$i]->pubDate);
        $html .= "

$title
$date

\n";
        $html .= "

$news

\n";
 
    }
 
    return $html;
}
echo "

Nyhetsfl?de fr?n Moderat.se

";

// Define number of feed items (url, NUMBER)

$url = "http://www.moderat.se/skane/feeds/news.xml";
echo fusion_photocopier($url, 5);



$url = "http://www.moderat.se/feeds/news.xml";
echo fusion_photocopier($url, 15);


$url = "http://www.moderat.se/feeds/press.xml";
echo fusion_photocopier($url, 5);


?>


As you can see it is having issues grabbing some objects, any ideas?
Edited by Homdax on 11-04-2014 10:02
...just one among some friends...
 
skpacman
So, the standard format for regular rss.xml is this:

channel
   title
   link
   atom:link
   item
      title
      link
      description
      guid
      pubDate
      source


After taking a closer look at the code, it looks like it's doing fine on my server.

What, exactly, is the problem you're running against?

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
http://www.skpacman.com
KasteR
Richard,
I found a simple ajax rss reader script from w3schools.

Demo: http://www.kaster.us/reader.html

reader.html:












RSS-feed will be listed here...



parser.php:


//get the q parameter from URL
$q=$_GET["q"];

//find out which feed was selected
if($q=="Google") {
   $xml=("http://news.google.com/news?ned=us&topic=h&output=rss");
} elseif($q=="moderat-news") {
   $xml=("http://www.moderat.se/feeds/news.xml");
} elseif($q=="moderat-press") {
   $xml=("http://www.moderat.se/feeds/press.xml");
}

$xmlDoc = new DOMDocument();
$xmlDoc->load($xml);

//get elements from ""
$channel=$xmlDoc->getElementsByTagName('channel')->item(0);
$channel_title = $channel->getElementsByTagName('title')
->item(0)->childNodes->item(0)->nodeValue;
$channel_link = $channel->getElementsByTagName('link')
->item(0)->childNodes->item(0)->nodeValue;
$channel_desc = $channel->getElementsByTagName('description')
->item(0)->childNodes->item(0)->nodeValue;

//output elements from ""
echo("

  . "'>" . $channel_title . "");
echo("
");
echo($channel_desc . "

");

//get and output "" elements
$x=$xmlDoc->getElementsByTagName('item');
for ($i=0; $i<=2; $i++) {
  $item_title=$x->item($i)->getElementsByTagName('title')
  ->item(0)->childNodes->item(0)->nodeValue;
  $item_link=$x->item($i)->getElementsByTagName('link')
  ->item(0)->childNodes->item(0)->nodeValue;
  $item_desc=$x->item($i)->getElementsByTagName('description')
  ->item(0)->childNodes->item(0)->nodeValue;
  echo ("

  . "'>" . $item_title . "");
  echo ("
");
  echo ($item_desc . "

");
}
?>

What kind of formatting issues are you having specifically? And is the intended use of the script to be called from Fusion?

This scripts can be combined into one php file. We could then develop a reader file that may control it's layout.
 
http://kaster.us
Homdax
I intend it to look approximately as the screenshot above. The issues we have been having with this is the layout in itself in Fusion (boxes) and image handling. I simply had too much requirements on the presentation (even involving a slider with rss source) so I am just going back to basics and doing this one step at the time.

1. Working RSS considering the feed source
2. Display and formatting of text from Item 1
3. Display and formatting of image in item 1 in RSS
4. Adaptation to boxed layout
5. Layout in 4 columns, width | 30% | 30% | 15% | 15% | with other stuff in the smaller ones, being panels.
...just one among some friends...
 
KasteR
Ok, so the problem that I've ran into is finding a way to grab the image itself. First I'll mention, they are using html entities to build out their img elements..

Typically there's an actual tag that can be used to specify an image for an RSS feed. I'm thinking we could assign a class to the images, and use CSS to arrange them. I'll spend more time on this after I complete a theme I'm working on.
Also, your image shows 3 columns, but you've outlined 4.

And to be clear, you'll see the images in my demo because it's within the description tag. So the entire text body and images are treated as the same element. We need to seperate this.


Edited by KasteR on 11-05-2014 17:08
 
http://kaster.us
Homdax
Yeah, I always suspected there was some fishy and non standard with those feeds. I do not know if it is because they use some Drupal inherent script that is not vanilla or what.

Very nice work KasteR. If we sort out some import admin interface that allows for actually setting up the feeds as well, you might have an excellent infusion on the way.

Do you have any explanation for this:


Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 38 
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 39
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 40
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 41
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 38
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 39
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 40
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 41
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 38
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 39
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 40
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 41
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 38
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 39
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 40
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 41
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 38
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 39
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 40
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 41
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 38
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 39
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 40
Notice: Trying to get property of non-object in /home/eslovsmode/domains/eslovsmoderaterna.se/public_html/rss-feed-full-single-column-hien.php on line 41


In this link: http://www.eslovs...n-hien.php

That is of course with Hiens code, I not able to put up your code parser right now, hhm, wait , maybe via my Tablet... here is Hiens code again




 at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
/* require_once "maincore.php";
require_once THEMES."templates/header.php";
$locale['home'] = "Home";
add_to_title($locale['global_200'].$locale['home']);
require_once THEMES."templates/footer.php"; */

function fusion_photocopier($url, $items=5) {
    $html = "";
    $xml = simplexml_load_file($url);
    $i = 0;
    for($i=0; $i<=$items; $i++) {
        $title = utf8_decode($xml->channel->item[$i]->title);
        $link = utf8_decode($xml->channel->item[$i]->link);
        $news = utf8_decode($xml->channel->item[$i]->description);
        $date = utf8_decode($xml->channel->item[$i]->pubDate);
        $html .= "

$title
$date

\n";
        $html .= "

$news

\n";
    }
    return $html;
}
echo "

Nyhetsfl?de fr?n Moderat.se

";
// Define number of feed items (url, NUMBER)

$url = "http://www.moderat.se/skane/feeds/news.xml";
echo fusion_photocopier($url, 5);
$url = "http://www.moderat.se/feeds/news.xml";
echo fusion_photocopier($url, 15);
$url = "http://www.moderat.se/feeds/press.xml";
echo fusion_photocopier($url, 5);
?>

Edited by Homdax on 11-06-2014 00:35
...just one among some friends...
 
KasteR
I could probably find out when I return to a desktop. But looking at it, you can try to change this I suppose.

Find:

function fusion_photocopier($url, $items=5) {

Change to:

function fusion_photocopier($url, $items) {

Haven't tested it, hopefully it helps. The error refers to several lines in the loop that assigns the variables from the elements. I'm guessing this may be why.
 
http://kaster.us
Homdax
No, did not help.

Can you remove the form select part of your code, I will try the same approach with yours... I think I need a line that actually calls for the hard coded URL instead of this:

//find out which feed was selected
if($q=="Google") {
   $xml=("http://news.google.com/news?ned=us&topic=h&output=rss");
} elseif($q=="moderat-news") {
   $xml=("http://www.moderat.se/feeds/news.xml");
} elseif($q=="moderat-press") {
   $xml=("http://www.moderat.se/feeds/press.xml");
}

...just one among some friends...
 
KasteR
The function that Hien wrote is fine. The reason why you're receiving the error is for a simple reason.

The feed from http://www.modera...s/news.xml contains 10 items, and is called for 15. I still do not understand why 5 is specified in the function variable $items. There's no point in having this optional field if it's going to be a set value. Maybe this occoured by while debugging this issue.

In any case, try this. Let me know.



/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright ? 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html  Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
function fusion_photocopier($url, $items) {
    $html = "";
    $xml = simplexml_load_file($url);
 
    $i = 0;
    for($i=0; $i<=$items-1; $i++) {
         $title = utf8_decode($xml->channel->item[$i]->title);
        $link = utf8_decode($xml->channel->item[$i]->link);
        $news = utf8_decode($xml->channel->item[$i]->description);
        $date = utf8_decode($xml->channel->item[$i]->pubDate);
        $html .= "

$title
$date

\n";
        $html .= "

$news

\n";
     }
     return $html;
}
opentable("RSS");
echo "

Nyhetsfl?de fr?n Moderat.se

";
// Define number of feed items (url, NUMBER)
   $url = "http://www.moderat.se/skane/feeds/news.xml";
      echo fusion_photocopier($url, 5);
   $url = "http://www.moderat.se/feeds/news.xml";
      echo fusion_photocopier($url, 10);
   $url = "http://www.moderat.se/feeds/press.xml";
      echo fusion_photocopier($url, 5);
closetable();
require_once THEMES."templates/footer.php";
?>
 
http://kaster.us
KasteR
So I was able to grab the image from the description tag, and assign it to a variable, within the loop using preg_match.


$content = $xml->channel->item[$i]->description;
preg_match('/(]+>)/i', $content, $matches);

We're so close, need to work out some kinks. Such as, what if there's no image? But those things will be the easier things to deal with. Check it out:

 
http://kaster.us
Homdax
DAMN! JawDrop
Thats is closer to the final result we have ever been!

Post your bank account number, I actually have a small budget for this. Smile

I will get that code up during today if I get the access (pretty serious proxy and firewall we got here at work)

Mind you, we should be able to identify the diff feeds (title) and perhaps have a feed title on/off function , and if the code could be remade in to an working infusion, with layout options, we have a winner. Make sure you don't lock up any display options since I will need to mess around a bit with that to fit the site.

The $item was intended to sort amount of feeds to display. Considering we are aiming for display on the first feed item with image (if any) and then that linked to the rest of the feeds (see feed > click on feed > get full text > option to click again and see all feeds full text)
Edited by Homdax on 11-06-2014 23:26
...just one among some friends...
 
KasteR
No problem. The grid layout now is controlled through bootstrap. We could use an alternative if you prefer. Either way. I have some sorting/filtering ideas, and alternative layout display (table & list) controls. Or a slider carrousel would be easy.

Imagination is the limit. I'll mess around with it more in the morning when I get to a desktop. Cheers.
 
http://kaster.us
KasteR
So I've added a plugin called MixItUp to handle the filtering, sorting and display options. I've added the Channel Title in the loop as well. There was Item Title, but not Channel Title.

One problem I've noticed though, is that the Skane News and regular News titles are both labeled as News. I'm thinking the source url may be a better option. I think an infusion would be an excellent idea. But with that, will come a lot more work (obviously). Perhaps that would be a better option implemented as phase 2. Get you situated first, and then spend more time on this.

Aside from the Channel Title issue, additionally when filtering, the columns remain as they were. Meaning that it's not working as fluid as the container should be. But you can see what kind of features the MixItUp plugin offers. The screenshots show the issue I'm refering to.

Update:
I corrected the column issue when filtering. Still have more work to do. I was thinking about setting it up so that when the user clicks the title of the item, the full content is displayed in a modal dialog box. Similar to how I have the login link on the navigation bar. Sound good?

Sorry for writing a bible here. I feel like I've been held back so much with not having a computer..

KasteR attached the following file:
You are not allowed to see attachments in this thread.

Edited by KasteR on 11-07-2014 16:51
 
http://kaster.us
Jump to Forum
Similar Threads
Thread Forum Replies Last Post
The woes of Modding Communities General Chat 7 02-22-2015 01:26