TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 04:43:06 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,105
  • Total Topics: 21,213
  • Online today: 243
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 245
  • Total: 245

RSS Feeds for articles

Started by lurkalot, March 04, 2018, 04:30:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lurkalot

Rather than use a third party script, would it be possible too ad a RSS feeds to articles. So these can be displayed on separate pages.  News feed page, ebay listings etc. A handy feature for affiliate publishers.

tino

Quote from: lurkalot on March 04, 2018, 04:30:04 PM
Rather than use a third party script, would it be possible too ad a RSS feeds to articles. So these can be displayed on separate pages.  News feed page, ebay listings etc. A handy feature for affiliate publishers.

You can do that on a page currently, choose PHP then add the following;

global $context;

$context['TPortal']['rss_notitles'] = true;

$context['TPortal']['rssmaxshown'] = 10;

echo 'ikmultimedia.com'.PHP_EOL;

TPparseRSS('http://www.ikmultimedia.com/rss.php');

echo 'blog.andertons.co.uk'.PHP_EOL;

TPparseRSS('https://blog.andertons.co.uk/feed/');

lurkalot

Neat trick. Thank you.

I'll give that a try.  Does this mean we're getting closer to the blocks in blocks feature I asked about a while ago, or just is it limited to the rss function?

tino

Quote from: lurkalot on March 04, 2018, 06:39:31 PM
Neat trick. Thank you.

I'll give that a try.  Does this mean we're getting closer to the blocks in blocks feature I asked about a while ago, or just is it limited to the rss function?

That's just calling the RSS function directly. You can do that with any function just pass the correct parameters to it.

Some might need some styling but it's essentially your imagination which would hold you back.

I don't like the php article option as it uses eval and I view that as evil and dangerous. But I do see it's use.

I could if I managed to hack a forum delete all data in the database for example with one line of code. Amongst many other things. SMF uses it also, you just have to be careful with who gets access.

lurkalot

Yay, it does work, just been messing about with it.  You're right about the styling, it does need some work in that department, especially if you turn the images on.

Not bad if just used as a list though, but in a article it could probably do with splitting into two columns to fill the page.  Has potential though.

PHP article system gets a fair amount of use, mainly for site functions etc.  In daily use, I wouldn't recommend anyone gives out permissions to use php, or html articles to anyone unless trusted immensely.

tino

Try that...

Can probably add image styling in there as well.

Might be an idea to split this topic up as we're digressing here.



global $context;

$context['TPortal']['rss_notitles'] = true;

$context['TPortal']['rssmaxshown'] = 10;

echo '<div style="min-height:250px; padding: 10px;">';
echo '<div style="float: left;">';
echo 'ikmultimedia.com'.PHP_EOL;

TPparseRSS('http://www.ikmultimedia.com/rss.php');
echo '</div>';

echo '<div style="float: right;">';
echo 'blog.andertons.co.uk'.PHP_EOL;
TPparseRSS('https://blog.andertons.co.uk/feed/');
echo '</div>';
echo '</div>';


lurkalot

Thanks, can split topic, but atm, if being honest I'm not sure where to put it.

illori

either resources or block code, not really a block code but it is a "block of code"

lurkalot

Quote from: illori on March 04, 2018, 09:13:49 PM
either resources or block code, not really a block code but it is a "block of code"

I was thinking perhaps, "Tinyportal Feature Requests" should be it's own board, then at least a new topic could be started for each request, or is that too much?  At the moment all request are in one topic, and things get messy like now.  Maybe add as a child board to feedback?

tino

Quote from: lurkalot on March 04, 2018, 08:43:43 PM
Thanks, can split topic, but atm, if being honest I'm not sure where to put it.

Resources, would be where I would put it.

lurkalot

I have done as you requested, though it was originally a feature request.

tino

You can leave your opening post in the feature request section. The rest is an alternative to that.

lurkalot

Getting back to this.  ;)

Yep that sort of works, but you only have to zoom slightly and the right column drops below and to the right of the left column, and it bursts out of the bottom of the article frame.  Social icons disappear up the sides of the page.

tino

I don't get why you would zoom on a page? I've never understood why you would do that, it's not simulating a mobile device as you're not refreshing the page.

lurkalot

Quote from: tino on March 04, 2018, 10:24:46 PM
I don't get why you would zoom on a page? I've never understood why you would do that, it's not simulating a mobile device as you're not refreshing the page.

Does the same in window resizer in Chrome, and in Responsive design mode in firefox. Thing is, if every browser has that feature, you can bet your life someone's going to use it.

Why has every browser got a zoom tool anyway?

tino

Quote from: lurkalot on March 04, 2018, 10:46:48 PM

Why has every browser got a zoom tool anyway?

Without JavaScript, almost every site will break if you zoom. It was a question on its usefulness, I assumed you were simulating a mobile view ( what many people seem to use it for )

For it to work on mobile it needs @media queries so that the divs float one above the other.


lurkalot

Quote from: tino on March 04, 2018, 10:52:34 PM
Quote from: lurkalot on March 04, 2018, 10:46:48 PM

Why has every browser got a zoom tool anyway?

Without JavaScript, almost every site will break if you zoom. It was a question on its usefulness, I assumed you were simulating a mobile view ( what many people seem to use it for )

For it to work on mobile it needs @media queries so that the divs float one above the other.

OK, then, so it won't work for responsive layouts, which is a tad disappointing. In that case it'll be fine for none responsive setups I guess.  Though it would be a handy thing to have for responsive layout, especially as that's where everything is heading.

I use the zoom sometimes when I haven't my glasses handy, or lose them.  ;)


tino

This should sort the overflow issue. I'm yet to position one above the other when its in mobile view.


global $context;

echo '<style type="text/css">

.rss-feed-right
{
    color : blue;
    float: right;
    width: 50%;
    height: 100%;
}

.rss-feed-left
{
    color : blue;
    float: left;
    width: 50%;
    height: 100%;
}

@media only screen and (max-width: 640px) {

.rss-feed-left
{
   display: table-row-group;
}

.rss-feed-right
{
   display: table-footer-group;
}

}

</style>';

$context['TPortal']['rss_notitles'] = true;

$context['TPortal']['rssmaxshown'] = 10;

echo '<div style="padding: 10px; display:table;">';
echo '<div class="rss-feed-left">';
echo 'ikmultimedia.com'.PHP_EOL;

TPparseRSS('http://www.ikmultimedia.com/rss.php');
echo '</div>';

echo '<div class="rss-feed-right">';
echo 'blog.andertons.co.uk'.PHP_EOL;
TPparseRSS('https://blog.andertons.co.uk/feed/');
echo '</div>';
echo '</div>';


tino

Just needed to remove the floats;



global $context;

echo '<style type="text/css">

.rss-feed-right
{
    color : blue;
    float: right;
    width: 50%;
    height: 100%;
}

.rss-feed-left
{
    color : blue;
    float: left;
    width: 50%;
    height: 100%;
}

@media only screen and (max-width: 640px) {

.rss-feed-left
{
   float: none;
   display: table-row-group;
}

.rss-feed-right
{
   float: none;
   display: table-footer-group;
}

}

</style>';

$context['TPortal']['rss_notitles'] = true;

$context['TPortal']['rssmaxshown'] = 10;

echo '<div style="padding: 10px; display:table;">';
echo '<div class="rss-feed-left">';
echo 'ikmultimedia.com'.PHP_EOL;

TPparseRSS('http://www.ikmultimedia.com/rss.php');
echo '</div>';

echo '<div class="rss-feed-right">';
echo 'blog.andertons.co.uk'.PHP_EOL;
TPparseRSS('https://blog.andertons.co.uk/feed/');
echo '</div>';
echo '</div>';


lurkalot

Quote from: tino on March 05, 2018, 07:22:01 PM
Just needed to remove the floats;



global $context;

echo '<style type="text/css">

.rss-feed-right
{
    color : blue;
    float: right;
    width: 50%;
    height: 100%;
}

.rss-feed-left
{
    color : blue;
    float: left;
    width: 50%;
    height: 100%;
}

@media only screen and (max-width: 640px) {

.rss-feed-left
{
   float: none;
   display: table-row-group;
}

.rss-feed-right
{
   float: none;
   display: table-footer-group;
}

}

</style>';

$context['TPortal']['rss_notitles'] = true;

$context['TPortal']['rssmaxshown'] = 10;

echo '<div style="padding: 10px; display:table;">';
echo '<div class="rss-feed-left">';
echo 'ikmultimedia.com'.PHP_EOL;

TPparseRSS('http://www.ikmultimedia.com/rss.php');
echo '</div>';

echo '<div class="rss-feed-right">';
echo 'blog.andertons.co.uk'.PHP_EOL;
TPparseRSS('https://blog.andertons.co.uk/feed/');
echo '</div>';
echo '</div>';



That works pretty nicely in this mode rss_notitles'] = true;  Actually seems to respond and stack neatly.  Turning on the images with rss_notitles'] = false; causes some issues though, but I'm happy with the list view.

One question, this line for the vendor,
echo 'ikmultimedia.com'.PHP_EOL;
Appears to be clickable.

this line for the second vendor
echo 'blog.andertons.co.uk'.PHP_EOL;
Doesn't appear to be clickable.

Great progress on this though, thank you.

tino

Quote from: lurkalot on March 05, 2018, 07:40:03 PM

One question, this line for the vendor,
echo 'ikmultimedia.com'.PHP_EOL;
Appears to be clickable.

this line for the second vendor
echo 'blog.andertons.co.uk'.PHP_EOL;
Doesn't appear to be clickable.

Great progress on this though, thank you.

They are just echo statements and aren't links. If you wanted them to be links then they need to be like this...

echo '[url=http://blog.andertons.co.uk]blog.andertons.co.uk[/url]'.PHP_EOL;

tino

Try changing the width to 45% instead of 50%, the images should scale to the width then.

If you want to style the images then use, amend the values as you wish


.rss-feed-right img {
    width: 50%;
    height: auto;
}

.rss-feed-left img {
    width: 50%;
    height: auto;
}

lurkalot

Thank you tino.

I'm testing it now with a couple of ebay rss feeds, but having real trouble getting it to look right. Needs some space to separate the panels.  And the rss_date I can't position to the left without distorting things.  Might just be these feeds controlling the layout, and me not being able to override them.

This is the feeds I was playing with.

global $context;

echo '<style type="text/css">

/*Date item added to ebay*/
.rss_date {
    color : white;
}

.rss-feed-right img {
    width: 45%;
}

.rss-feed-left img {
    width: 45%;
}

.rss-feed-right {
    color : white;
    float: right;
    width: 50%;
    height: 100%;
}

.rss-feed-left {
    color : white;
    float: left;
    width: 50%;
    height: 100%;
}

@media only screen and (max-width: 640px) {

.rss-feed-left
{
   float: none;
   display: table-row-group;
}

.rss-feed-right
{
   float: none;
   display: table-footer-group;
}

}

</style>';

$context['TPortal']['rss_notitles'] = false;

$context['TPortal']['rssmaxshown'] = 10;

echo '<div style="padding: 10px; display:table;">';
echo '<div class="rss-feed-left">';

TPparseRSS('https://www.ebay.co.uk/sch/i.html?_from=R40&_nkw=Electric+guitar&_sacat=0&LH_BIN=1&LH_ItemCondition=1000&LH_PrefLoc=1&_rss=1');
echo '</div>';

echo '<div class="rss-feed-right">';
TPparseRSS('https://www.ebay.co.uk/sch/i.html?_osacat=29518&_odkw=chainsaw+parts+accessories&_from=R40&_trksid=p2334524.m570.l2632.R2.TR12.TRC2.A0.H3.Xdash.TRS0&_nkw=dash+cam&_sacat=3270&_rss=1');
echo '</div>';
echo '</div>';


tino


global $context;

echo '<style type="text/css">

/*Date item added to ebay*/
.rss_date {
    color : white;
    text-align: unset;
}

.rss-feed-right img {
    width: 45%;
}

.rss-feed-left img {
    width: 45%;
}

.rss-feed-right {
    color : white;
    width: 45%;
    height: 100%;
    float: right;
}

.rss-feed-left {
    color : white;
    width: 45%;
    height: 100%;
    float: left;
}

@media only screen and (max-width: 640px) {

.rss-feed-left
{
   float: none;
   display: table-row-group;
}

.rss-feed-right
{
   float: none;
   display: table-footer-group;
}

}

</style>';

$context['TPortal']['rss_notitles'] = false;

$context['TPortal']['rssmaxshown'] = 10;

echo '<div style="padding: 10px; display:table; width: 90%">';
echo '<div class="rss-feed-left">';
TPparseRSS('https://www.ebay.co.uk/sch/i.html?_from=R40&_nkw=Electric+guitar&_sacat=0&LH_BIN=1&LH_ItemCondition=1000&LH_PrefLoc=1&_rss=1');
echo '</div>';

echo '<div class="rss-feed-right">';
TPparseRSS('https://www.ebay.co.uk/sch/i.html?_osacat=29518&_odkw=chainsaw+parts+accessories&_from=R40&_trksid=p2334524.m570.l2632.R2.TR12.TRC2.A0.H3.Xdash.TRS0&_nkw=dash+cam&_sacat=3270&_rss=1');
echo '</div>';
echo '</div>';

lurkalot

Thanks you tino.  Much better, I think I can use that now.  8)

Will experiment with other feeds to see how they look.