• Welcome to PHPVIBE Forums. Please log in.

[ Video Sharing CMS v4 ] Feed error

Started by x5000x,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

x5000xTopic starter

Invalid argument supplied for foreach() in /public_html/feed.php on line 18
Cannot modify header information - headers already sent by (output started at /public_html/feed.php:18) in /public_html/lib/rss.class.php on line 231
  •  

PHPVibe A.

I can't help with this limited info.

x5000xTopic starter

Alex,

That is the error i get in log files.
  •  

PHPVibe A.

#3
Show me your url again, I'll have an look tomorrow.
The error basically says it doesn't get any videos.

hamnawa

Were you guys able to fix this issue? I am facing same issue on PhpVibe 3.6.

Error:
[22-Apr-2014 19:12:02 UTC] PHP Warning:  Invalid argument supplied for foreach() in /home/saleel/public_html/feed.php on line 18
[22-Apr-2014 19:12:02 UTC] PHP Warning:  Invalid argument supplied for foreach() in /home/saleel/public_html/feed.php on line 18
[23-Apr-2014 04:40:56 UTC] PHP Warning:  Invalid argument supplied for foreach() in /home/saleel/public_html/feed.php on line 18
[23-Apr-2014 04:54:58 UTC] PHP Warning:  Invalid argument supplied for foreach() in /home/saleel/public_html/feed.php on line 18
[23-Apr-2014 05:04:57 UTC] PHP Warning:  Invalid argument supplied for foreach() in /home/saleel/public_html/feed.php on line 18
[23-Apr-2014 06:20:45 UTC] PHP Warning:  Invalid argument supplied for foreach() in /home/saleel/public_html/feed.php on line 18


Feed.php
<?php  error_reporting(E_ALL); 
//Vital file include
require_once("load.php");
require_once( INC.'/rss.class.php' );

//Initialize RSS:
	$rss = new FeedRSS(_html(get_option('site-logo-text')), site_url().'feed/', _html(seo_desc()), current_lang(), _html(get_option('site-copyright')), '', '', '', '', '');
	if(get_option('site-logo')) {
	$rss->AddImage(_html(get_option('site-logo-text')), thumb_fix(get_option('site-logo')), site_url().'feed/', '145', '45', get_option('site-logo-text'));
}
$options = DB_PREFIX."videos.*, ".DB_PREFIX."channels.cat_name as channel_name ,".DB_PREFIX."users.name as owner";
if(_get("m") && (intval(_get("m")) > 0)) {
$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."channels ON ".DB_PREFIX."videos.category =".DB_PREFIX."channels.cat_id  LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.views >= 0 and ".DB_PREFIX."videos.pub > 0 and ".DB_PREFIX."videos.media ='".intval(_get("m"))."' ORDER BY ".DB_PREFIX."videos.id DESC ".this_limit();
} else {
$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."channels ON ".DB_PREFIX."videos.category =".DB_PREFIX."channels.cat_id  LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.views >= 0 and ".DB_PREFIX."videos.pub > 0  ORDER BY ".DB_PREFIX."videos.id DESC ".this_limit();
}
$videos = $db->get_results($vq);
foreach ($videos as $video) {
if(!empty($video->title)) {
$rss->AddArticle(_html($video->title), video_url($video->id , $video->title), gmdate(DATE_RSS, strtotime($video->date)), $video->owner, $video->channel_name, channel_url($video->category,$video->channel_name), _cut(_html($video->description),20), _html($video->description));
}
}
	
//Publish RSS:
	$rss->Output();
?>
  •  

MacKen

 if ($videos) {
   foreach ($videos as $video) {
   }
}
<----------------------------------------------------------------->
CODE:

Quote<?php  error_reporting(E_ALL);
//Vital file include
require_once("load.php");
require_once( INC.'/rss.class.php' );

//Initialize RSS:
   $rss = new FeedRSS(_html(get_option('site-logo-text')), site_url().'feed/', _html(seo_desc()), current_lang(), _html(get_option('site-copyright')), '', '', '', '', '');
   if(get_option('site-logo')) {
   $rss->AddImage(_html(get_option('site-logo-text')), thumb_fix(get_option('site-logo')), site_url().'feed/', '145', '45', get_option('site-logo-text'));
}
$options = DB_PREFIX."videos.*, ".DB_PREFIX."channels.cat_name as channel_name ,".DB_PREFIX."users.name as owner";
if(_get("m") && (intval(_get("m")) > 0)) {
$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."channels ON ".DB_PREFIX."videos.category =".DB_PREFIX."channels.cat_id  LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.views >= 0 and ".DB_PREFIX."videos.pub > 0 and ".DB_PREFIX."videos.media ='".intval(_get("m"))."' ORDER BY ".DB_PREFIX."videos.id DESC ".this_limit();
} else {
$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."channels ON ".DB_PREFIX."videos.category =".DB_PREFIX."channels.cat_id  LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.views >= 0 and ".DB_PREFIX."videos.pub > 0  ORDER BY ".DB_PREFIX."videos.id DESC ".this_limit();
}
$videos = $db->get_results($vq);
if ($videos) {
foreach ($videos as $video) {
if(!empty($video->title)) {
$rss->AddArticle(_html($video->title), video_url($video->id , $video->title), gmdate(DATE_RSS, strtotime($video->date)), $video->owner, $video->channel_name, channel_url($video->category,$video->channel_name), _cut(_html($video->description),20), _html($video->description));
                                 }
                                      }
}
   
//Publish RSS:
   $rss->Output();
?>
  •  

MacKen

MY CODE :
Quote<?php  error_reporting(E_ALL);
//Vital file include
require_once("load.php");
require_once( INC.'/rss.class.php' );

//Initialize RSS:
   $rss = new FeedRSS(_html(get_option('site-logo-text')), site_url().'feed/', _html(seo_desc()), current_lang(), _html(get_option('site-copyright')), '', '', '', '', '');
   if(get_option('site-logo')) {
   $rss->AddImage(_html(get_option('site-logo-text')), thumb_fix(get_option('site-logo')), site_url().'feed/', '145', '45', get_option('site-logo-text'));
}
if (_get("m") && (intval(_get("m")) > 0)) {
$options = DB_PREFIX."videos.*, ".DB_PREFIX."channels.cat_name as channel_name ,".DB_PREFIX."users.name as owner";

$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."channels ON ".DB_PREFIX."videos.category =".DB_PREFIX."channels.cat_id  LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.views >= 0 and ".DB_PREFIX."videos.pub > 0 and ".DB_PREFIX."videos.media ='".intval(_get("m"))."' ORDER BY ".DB_PREFIX."videos.id DESC ".this_limit();

$videos = $db->get_results($vq);
if ($videos) {
   foreach ($videos as $video) {
         if(!empty($video->title)) {
             $rss->AddArticle(_html($video->title), video_url($video->id , $video->title), gmdate(DATE_RSS, strtotime($video->date)), $video->owner, $video->channel_name, channel_url($video->category,$video->channel_name), _cut(_html($video->description),20), _html($video->description));
          }
    }
  }
} else {
$optionsv = DB_PREFIX."videos.*, ".DB_PREFIX."channels.cat_name as channel_name ,".DB_PREFIX."users.name as owner";
$vq = "select ".$optionsv.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."channels ON ".DB_PREFIX."videos.category =".DB_PREFIX."channels.cat_id  LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.views >= 0 and ".DB_PREFIX."videos.pub > 0  ORDER BY ".DB_PREFIX."videos.id DESC ".this_limit();
      $videosv = $db->get_results($vq);
if ($videosv) {
   foreach ($videosv as $video) {
         if(!empty($video->title)) {
             $rss->AddArticle(_html($video->title), video_url($video->id , $video->title), gmdate(DATE_RSS, strtotime($video->date)), $video->owner, $video->channel_name, channel_url($video->category,$video->channel_name), _cut(_html($video->description),20), _html($video->description));
          }
    }
  }

}


//Publish RSS:
   $rss->Output();
?>
  •  

PHPVibe A.

I assume they have videos MacKen, what I need to know is if they are new installs or upgrades, so I can think what the issue might be.

hamnawa

What about mine? Mine is New fresh install of 3.6.

I have only manually restored vibe_videos and vibe_users tables in to the newly installed version.
  •  

PHPVibe A.

Did you do an database check and optimize after?

hamnawa

Yes I did that and got OK results for both of those imported tables.
  •  

hamnawa

This feed.php line 18 error still happening on my side it is not very often but I see it often in error_log.
  •  

hamnawa

Can anyone help me? I am getting this error on new fresh install also:

[30-Apr-2014 18:53:45 UTC] PHP Warning:  Invalid argument supplied for foreach() in /home/caleel/public_html/feed.php on line 18
[30-Apr-2014 18:54:13 UTC] PHP Warning:  Invalid argument supplied for foreach() in /home/caleel/public_html/feed.php on line 18
[01-May-2014 08:59:22 UTC] PHP Warning:  Invalid argument supplied for foreach() in /home/caleel/public_html/feed.php on line 18
[01-May-2014 08:59:24 UTC] PHP Warning:  Invalid argument supplied for foreach() in /home/caleel/public_html/feed.php on line 18



feed.php
<?php  error_reporting(E_ALL); 
//Vital file include
require_once("load.php");
require_once( INC.'/rss.class.php' );

//Initialize RSS:
	$rss = new FeedRSS(_html(get_option('site-logo-text')), site_url().'feed/', _html(seo_desc()), current_lang(), _html(get_option('site-copyright')), '', '', '', '', '');
	if(get_option('site-logo')) {
	$rss->AddImage(_html(get_option('site-logo-text')), thumb_fix(get_option('site-logo')), site_url().'feed/', '145', '45', get_option('site-logo-text'));
}
$options = DB_PREFIX."videos.*, ".DB_PREFIX."channels.cat_name as channel_name ,".DB_PREFIX."users.name as owner";
if(_get("m") && (intval(_get("m")) > 0)) {
$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."channels ON ".DB_PREFIX."videos.category =".DB_PREFIX."channels.cat_id  LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.views >= 0 and ".DB_PREFIX."videos.pub > 0 and ".DB_PREFIX."videos.media ='".intval(_get("m"))."' ORDER BY ".DB_PREFIX."videos.id DESC ".this_limit();
} else {
$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."channels ON ".DB_PREFIX."videos.category =".DB_PREFIX."channels.cat_id  LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.views >= 0 and ".DB_PREFIX."videos.pub > 0  ORDER BY ".DB_PREFIX."videos.id DESC ".this_limit();
}
$videos = $db->get_results($vq);
foreach ($videos as $video) {
if(!empty($video->title)) {
$rss->AddArticle(_html($video->title), video_url($video->id , $video->title), gmdate(DATE_RSS, strtotime($video->date)), $video->owner, $video->channel_name, channel_url($video->category,$video->channel_name), _cut(_html($video->description),20), _html($video->description));
}
}
	
//Publish RSS:
	$rss->Output();
?>
  •  

x5000xTopic starter

Use this code and will eliminate that problem:

<?php  error_reporting(E_ALL); 
//Vital file include
require_once("load.php");
require_once( INC.'/rss.class.php' );

//Initialize RSS:
	$rss = new FeedRSS(_html(get_option('site-logo-text')), site_url().'feed/', _html(seo_desc()), current_lang(), _html(get_option('site-copyright')), '', '', '', '', '');
	if(get_option('site-logo')) {
	$rss->AddImage(_html(get_option('site-logo-text')), thumb_fix(get_option('site-logo')), site_url().'feed/', '145', '45', get_option('site-logo-text'));
}
$options = DB_PREFIX."videos.*, ".DB_PREFIX."channels.cat_name as channel_name ,".DB_PREFIX."users.name as owner";
if(_get("m") && (intval(_get("m")) > 0)) {
$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."channels ON ".DB_PREFIX."videos.category =".DB_PREFIX."channels.cat_id  LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.views >= 0 and ".DB_PREFIX."videos.pub > 0 and ".DB_PREFIX."videos.media ='".intval(_get("m"))."' ORDER BY ".DB_PREFIX."videos.id DESC ".this_limit();
} else {
$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."channels ON ".DB_PREFIX."videos.category =".DB_PREFIX."channels.cat_id  LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.views >= 0 and ".DB_PREFIX."videos.pub > 0  ORDER BY ".DB_PREFIX."videos.id DESC ".this_limit();
}
$videos = $db->get_results($vq);
if ($videos) {
foreach ($videos as $video) {
if(!empty($video->title)) {
$rss->AddArticle(_html($video->title), video_url($video->id , $video->title), gmdate(DATE_RSS, strtotime($video->date)), $video->owner, $video->channel_name, channel_url($video->category,$video->channel_name), _cut(_html($video->description),20), _html($video->description));
                                 }
                                      }
}
	
//Publish RSS:
	$rss->Output();
?>
  •  

hamnawa

Thank you, I have modified my code will monitor and see the results.
  •  

Similar topics (7)