BOARDS

planetluc.com discussion board

all about the planetlu.com scripts

You are not logged in.

Announcement

I had to clean the boards due to massive spam. Actually i deleted everything /-one after 1st Oct 2008. It was the only way to get this spam out of the boards. So i'm sorry for all serious users who registered/posted meanwhile.

#1 25-08-2008 20:21:15

matador
Member
Registered: 18-08-2008
Posts: 18

Add post until a date

As the script mynews works today you can add either a dynamic or static post. A dynamic post is displayed from the date and time that you enter. Is it possible to change this so that news are deleted at the time you've chosen? It would take care of lots of problems for me, as I have to check the homepage all the time so that no news that people have added are out of date.

Offline

 

#2 27-08-2008 00:13:31

sidtheduck
Moderator
From: down by the water
Registered: 14-07-2006
Posts: 515
Website

Re: Add post until a date

matador,

Did you want news to be deleted after a certain time period, or just not shown?


If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands.                ~Douglas Adams~

Offline

 

#3 27-08-2008 12:12:53

matador
Member
Registered: 18-08-2008
Posts: 18

Re: Add post until a date

Either would one would be great! That would solve so much trouble for me.

Offline

 

#4 29-08-2008 18:19:29

sidtheduck
Moderator
From: down by the water
Registered: 14-07-2006
Posts: 515
Website

Re: Add post until a date

matador,

To accomplish this, open '/forum/mynews.inc.html' and edit the following code.

Find this code (starting around line 37):

$me= $_SERVER['PHP_SELF'];
$empty=false;
$now=time();
$version="1.6.4";

and edit is as:

$me= $_SERVER['PHP_SELF'];
$empty=false;
$now=time();
$then = strtotime('-2 weeks', $now); // this is the cutoff time
$version="1.6.4";

Then, find the following code (should be about line 321):

if ($line[2]=="static" || ($line[2]=="dynamic" && $line[1]<$now) || isloggedin() ){

edit it as:

if ($line[2]=="static" || ($line[2]=="dynamic" && $line[1]<$now
&& $line[1] >= $then) || isloggedin() ){

That should do it for you!


If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands.                ~Douglas Adams~

Offline

 

#5 29-08-2008 20:19:17

matador
Member
Registered: 18-08-2008
Posts: 18

Re: Add post until a date

Thanks so much for taking time to help! I'm afraid though, that the changes didn't work. The news are displayed the same way as before, i.e. from the set time and onwards. I wish I could help with more log files or error messages but its not gcc compilation...

Offline

 

#6 29-08-2008 20:50:33

sidtheduck
Moderator
From: down by the water
Registered: 14-07-2006
Posts: 515
Website

Re: Add post until a date

Am I not understanding you correctly?  The way I understood your first post is that for dynamic posts, you would like to display the post items for a certain time period.

The code above would display a dynamic post for 2 weeks, and then it will not show it (unless you are logged in as the administrator).  If it is a static post, it will be displayed no matter what.

Is there something that I'm missing?


If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands.                ~Douglas Adams~

Offline

 

#7 29-08-2008 21:40:13

matador
Member
Registered: 18-08-2008
Posts: 18

Re: Add post until a date

You understood me correct. To post news until the set date then hide or delete it.

The thing is, I did the changes and set a dynamic date but it worked just as before. I published news for test 5 minutes ahead of time. What happened was that it didn't show up until after the 5 minutes had passed.

Am I missing something?

Offline

 

#8 29-08-2008 22:10:51

sidtheduck
Moderator
From: down by the water
Registered: 14-07-2006
Posts: 515
Website

Re: Add post until a date

Oh, so do you want to set a "dynamic" cut-off time for each post so that it will only show up until that date/time?

The code I have above has a static cut-off time for all posts of whatever you set for the variable $then.  The dynamic post still works as normal, but does not show after your $then date.
For example: I create a post that I'm writing right now, but I want it to be published tomorrow and run for 2 days.  My $then would be set for ('-2 days') and I would set the date of the post for tomorrow.  All posts would have a cut-off date of 2 days from the date posted.

What I think you are trying to do is set the date of the post (for 5 minutes from now) and the post will show until that time (i.e. you won't be able to pre-post, they will all be shown as soon as you hit save) which will create a dynamic cut-off time.

Is this correct?

If so, you don't need the $then variable above and you would change this:

if ($line[2]=="static" || ($line[2]=="dynamic" && $line[1]<$now) || isloggedin() ){

to this:

if ($line[2]=="static" || ($line[2]=="dynamic" && $line[1] > $now) || isloggedin() ){


If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands.                ~Douglas Adams~

Offline

 

#9 29-08-2008 22:58:03

matador
Member
Registered: 18-08-2008
Posts: 18

Re: Add post until a date

That did it. Thanks a billion! I'm only a student but you've got a small gift as appreciation over paypal.

Offline

 

#10 29-08-2008 23:40:30

sidtheduck
Moderator
From: down by the water
Registered: 14-07-2006
Posts: 515
Website

Re: Add post until a date

Great!  Glad it's working for you! :D


If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family anatidae on our hands.                ~Douglas Adams~

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson

 
 
© 2003-2010 by planetluc.com · Bachtelstrasse 104 · CH-8400 Winterthur | Support | Login |