How can I show news articles regardless of date

Need some help with the script?

How can I show news articles regardless of date

Postby Heya Im Me » Wed Nov 15, 2006 12:41 am

I'm wonder what file has to be modified so I can show news posts despite the date being in the 'future'?



So say I added a post that was dated 01 January 2007, how can I make that show up on the website regardless of it being November 2006 right now?



As always thanks for any help



-HIM
Heya Im Me
 
Posts: 189
Joined: Wed Feb 01, 2006 4:06 am

Postby FI-DD » Wed Nov 15, 2006 8:27 pm

1. Open inc/show.news.php and remove this:

Code: Select all
else {

      $where[] = 'date < '.(time() + $config_date_adjust * 60);

   }




2. Find this:

Code: Select all
$query = $sql->select(array(




add above:

Code: Select all
         $where[] = 'and';

         $where[] = 'date < '.(time() + $config_date_adjust * 60);

         $where[] = 'or';

         $where[] = 'date > '.(time() + $config_date_adjust * 60);

         if($where[0] == 'and') array_shift($where);
Last edited by FI-DD on Fri Nov 17, 2006 12:27 am, edited 2 times in total.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby Heya Im Me » Wed Nov 15, 2006 9:07 pm

Yesssssssssssss Thank you so much, FI-DD. Knew it was some line of code to remove but couldn't figure out which one. Wow, thanks!! :D :D :D



Also, could you take a gander whenever you have the time to at the post I made below this one? This question and the other one go hand-in-hand.



Thanks again, FI-DD, this program would be useless to me without you.



-HIM
Heya Im Me
 
Posts: 189
Joined: Wed Feb 01, 2006 4:06 am

Postby Heya Im Me » Thu Nov 16, 2006 2:50 am

Hm, FI-DD when I did that it produced an error



Code: Select all
txtSQL Warning: You have an error in your where clause, (operators allowed: =, !=, <>, =~, !~, <, >, <=, >=) in /home/www/site/site0607/index.php on line 79



Warning: Invalid argument supplied for foreach() in /home/www/site/data/inc/show.news.php on line 87





Any ideas?
Heya Im Me
 
Posts: 189
Joined: Wed Feb 01, 2006 4:06 am

Postby FI-DD » Thu Nov 16, 2006 9:12 pm

I edited my reply above.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby Heya Im Me » Thu Nov 16, 2006 9:32 pm

Hm, alright it's now showing "future" news except...it's showing every article in every category in my news now instead of just the news category. And the includes have $category set... Any ideas?



Also, thanks for continuing with the help on this one, it's the last part I swear! :D
Heya Im Me
 
Posts: 189
Joined: Wed Feb 01, 2006 4:06 am

Postby FI-DD » Fri Nov 17, 2006 12:27 am

Updated.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby Heya Im Me » Fri Nov 17, 2006 12:46 am

Hm, I get that same txtSQL warning mentioned above. Is it because I took out that else statement?
Heya Im Me
 
Posts: 189
Joined: Wed Feb 01, 2006 4:06 am

Postby FI-DD » Fri Nov 17, 2006 10:19 am

It's working for me. Maybe you try again with the original unchanged file?
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby potts » Tue Mar 27, 2007 11:01 pm

Hi FI-DD,



I've tried this with the original unchanged file, but I too am getting every article in every category for future dates. However, past dates seem to be correct and don't do this. Any ideas?



This similar solution worked perfectly for me, but unfortunately it removes the news items on the due date, (the day after would be fine):



http://english.cutenews.ru/forum/viewto ... ght=future





Thanks,

Richard
potts
 
Posts: 13
Joined: Mon Mar 26, 2007 10:17 pm
Location: UK

Postby FI-DD » Tue Mar 27, 2007 11:34 pm

Then take the other solution and try changing this:

Code: Select all
      if($schedule){

         $where[] = 'date > '.(time() + $config_date_adjust * 60);

      }

      else{

         $where[] = 'date < '.(time() + $config_date_adjust * 60);

      }

      $schedule = false;




to this:

Code: Select all
if($schedule){

  $where[] = 'date > '.(time() + $config_date_adjust * 60 - 86400);

}

else{

  $where[] = 'date < '.(time() + $config_date_adjust * 60);

}

$schedule = false;
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby potts » Wed Mar 28, 2007 12:02 am

Absolutely fantastic FI-DD!! :D



Thank you so much. The support here is just brilliant!
potts
 
Posts: 13
Joined: Mon Mar 26, 2007 10:17 pm
Location: UK

Postby dezza » Fri Apr 13, 2007 1:31 am

..
Last edited by dezza on Thu Dec 20, 2007 12:45 am, edited 1 time in total.
dezza
 
Posts: 13
Joined: Wed Apr 11, 2007 2:29 am

Postby Heya Im Me » Sun Apr 22, 2007 8:05 am

Hey FI-DD,



I was wondering if you could provide me with some insight on this problem. I followed the instructions and made all of the changes in show.news.php , even with

Code: Select all
  $where[] = 'date > '.(time() + $config_date_adjust * 60 - 86400);

}

else{

  $where[] = 'date < '.(time() + $config_date_adjust * 60);

}

$schedule = false;




My problem is now all the includes will show the same articles regardless of the specified category number but only if the date is set a more than a day in the 'future.' So if I added an article for April 23rd and it's the 22nd today, all includes would show that article regardless of category specified and schedule=true or false. If I add an article for April 22nd at 9pm and its April 22nd 1pm now, then only it'll just show in the specified category in an include, not all of the includes.



Do you have any idea whats going on? I've been trying to figure it out but I really have no idea.



As always, thanks for any help :)



-HIM
Heya Im Me
 
Posts: 189
Joined: Wed Feb 01, 2006 4:06 am

Postby FI-DD » Mon Apr 23, 2007 4:59 pm

I can't reproduce that behaviour. :?
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany


Return to Help



Who is online

Users browsing this forum: No registered users and 0 guests

cron