Pre-post, but only have it show up when it's a "current" entry.
(This script was originally written for Promoguy) The idea here is that you "pre-date" an entry. In Promo's case, he wanted to be able to write up his Monday Mission the day before, but not have it show up on his blog until it was actually Monday. Here's what you do:
Update 8/3/2002: (I've updated the script to a MUCH SIMPLER version thanks to PapaScott! It'll also let you control when the post shows up to the MINUTE!)
update 8/5/02: I've simplified the code further… I had some silly/stupid stuff in there before…
Step one:
"Install" the script below. (wanted to give you the instructions first, before I threw a bunch of code at you… so skip ahead to the code to do the installation…)
Step two:
Write your post, but save it as a draft.
Step three:
Once saved, you can edit the "date" of the post. Change the date to whatever day you want your post to actually show up.
Step four:
This time you save it, with "publish" as the Post Status instead.
That's it. It won't show up on your blog, until it's the date you set. (heh. I hope. Once again, only minimal testing has been done on this script… so, as always, use at your own risk)
NOW the code… There's alot of code (update: actually now there's ALOT less since I've updated it!), but no customization… you just need to copy and paste it in the right spot to get it to work… So, it's not as scary as it looks… ok? I promise.
(the code below is shown as an example of what goes on the index template… additional code will probably be required if you use individual entries and you don't want to have it show the "next" entry (until it's the right time) on the previous post.) I'll put it on my "to-do" list, which just gets longer and longer…
After your <MTEntries> tag, put the code as you see it below (I included the MTEntries tag, just for reference…) (please see commented notes below for what goes where). The code you need to paste is in red (the "existing tags" are in black)
<MTEntries>
<?
if (time() > strtotime ("<$MTEntryDate format="%B %e, %Y %I:%M %p"$>"))
{
?>
<!– PUT THE REST OF YOUR MT TAGS FOR YOUR POST BELOW –>
<MTDateHeader>
<h2><$MTEntryDate format="%B %d, %Y"$></h2>
</MTDateHeader>
<a name="<$MTEntryID pad="1"$>"></a>
<h1><$MTEntryTitle$></h1>
<p><i><$MTEntryDate format="%I:%M %p"$></i></p>
<$MTEntryBody$>
<MTEntryIfExtended>
<p><a href="<$MTEntryLink$>#<$MTEntryID pad="1"$>">MORE…</a></p>
</MTEntryIfExtended>
<p align="right"><a href="<$MTEntryLink$>#<$MTEntryID pad="1"$>">permalink</a>
<MTEntryIfAllowComments> | <a href="<$MTEntryLink$>#comments">
<$MTEntryCommentCount$> comments
</p>
</MTEntryIfAllowComments>
</p>
<br>
<!— END OF ALL YOUR MT TAGS FOR YOUR ENTRY –>
<!– Make sure you add the next little lines below BEFORE your put your "/MTEntries" tag. –>
<? } ?>
</MTEntries>
Let me know if you run into any problems, so I can try to fix the script.
March 18th, 2004 at 4:09 pm
There are a couple of ways of using Movable Type to create a calendar of events. One is to display future events as text entries, replacing the traditional bloggish today-going-backwards posting order. The key to this is the fact that…
December 9th, 2003 at 11:47 am
There are a couple of ways of using Movable Type to create a calendar of events. One is to display future events as text entries, replacing the traditional bloggish today-going-backwards posting order. The key to this is the fact that…
December 3rd, 2003 at 11:26 pm
Installed PrePost — a script from ScriptyGoddess that'll allow me to write a blog and have it publish on a…
October 5th, 2003 at 6:28 am
Gibt es einen Weg, wie MT Beiträge in der Zukunft publiziert?
October 3rd, 2003 at 7:18 am
Wenn anderswo hemmungslos testgemobloggt wird, kann ich hier ja mal kurz sehen, ob ich die Zeitverzögerung von Scriptygoddess richtig installiert habe….
September 16th, 2003 at 9:18 pm
So my wife and I make bets about little, petty things that are trivial to everyone but us. The betting mechanism has evolved as a way to allow us to resolve conflict without arguing in endless circles when simple agreement…
May 6th, 2003 at 1:10 am
Why should people suffer the pain of not reading your bloggy goodness just cuz you have to take your slacker ass off on a vacation? Think of your audience people! Don't they deserver better? Speaking for myself, Why, yes, damn it, you bet your sweet bi…
March 25th, 2003 at 9:55 pm
scriptygoddess…
April 26th, 2003 at 11:08 pm
This is a test to try out this code that I found on Scriptygoddess via this post at the Movable
January 20th, 2003 at 7:37 pm
There are a couple of ways of using Movable Type to create a calendar of events. One is to display
January 4th, 2003 at 5:28 pm
test to see if I've enabled the scheduled publication feature. This feature is a php-based hack from scriptygoddess.com, found here. Theoretically, it allows the publisher to set an entry to a date/time, and it won't appear until that date and time -…
December 8th, 2002 at 11:09 pm
A lot of people have this issue, because we (as bloggers), get inspired and write a whole bunch down without
November 6th, 2002 at 10:27 pm
Ever wanted to be able to post in the future? It may not be possible to do exactly that, but
January 26th, 2004 at 2:18 pm
Works great…as long as you use English as language for date display. But in my case I use Dutch and then the script won't work. Now I thought I could use the MT language tags (cz, dk, nl, en, fr, de, is, jp, it, no, pl, pt, si, es, fi, se. In my case nl.) to solve the problem, but I'm not sure where to place it. Any ideas?
January 3rd, 2004 at 3:55 pm
Anywhere you can get that $MTEntryDate tag to work – you can use the script… And in fact, you NEED to include it in every template to really "hide" it.
January 3rd, 2004 at 3:49 pm
It wasn't readily clear by the thread here, but can the code be applied to the date based and the category templates as well, besides the individual entry template?
December 4th, 2003 at 10:02 pm
The is a PHP script – you need to be running php on your page. (In most cases this means your page must have a .php extension – not .htm, or .html)
November 23rd, 2003 at 11:10 am
excellent script.. thanks!
December 4th, 2003 at 9:56 pm
I saw someone else had this same problem but did not see any answer in the comments. I get this string at the top of each post now and they are posting when I save as published.
strtotime ("December 4, 2003 09:00 PM")) { ?>
I inserted the code as instructed and saved in draft mode. Then from the same page at the bottom changed the date and post status. What did I do wrong? I have a whole group of people over at Munuviana that are wanting to implement this code.
Thanks for any assistance you can give me / us.
November 18th, 2003 at 10:30 am
I'm taking this to the mt support forums, i think it may be more of an MT issue. thanks though, still a very impressive and cool script!
November 18th, 2003 at 10:09 am
Hi, I'm trying to get this to work, and it seems to be close, but for some reason my site's popping out yesterday's posts instead of today's.
any ideas?
thanks
October 13th, 2003 at 12:36 am
For my particular situation I have found that MovableTypeTrickle works better. MovableTypeTrickle
Still great work, and I may use your code in other situations.
July 24th, 2003 at 9:26 pm
Got me, it works on my server. Could be a config issue. there is also the possibility that your server doesn't understand that the stuff after the first "%>" should be rendered as HTML. You could try doing response.write ("all your mt stuff in asp response.write format").
Maybe add the conditional else tag- like
else
response.write("")
Got me. It works for me. Matbe you should make the first Response.write happen on the next line (your original code has it on the same line as your "then" statement.)
I want it to work for you, so keep me posted.
July 24th, 2003 at 5:14 pm
Nope sorry, I'm using the exact code above in a basic ASP file….
July 24th, 2003 at 12:56 pm
Yeah, I know exaclty what that is (I think). You are using <%Option Explicit%>, aren't you? When you do that, it expects good code :p
What you could do is just remove <%Option Explicit%> – this won't stop your code from working. All this does is ensure you use 100% perfect ASP code. Also, it does give you better error management. without it, your errors will become generic (they won't tell you what line causes the error, but it looks like you don't get that anyway).
I hope that fixes it.
July 24th, 2003 at 10:01 am
Jai,
Another ASP person here, I'm trying to use your code, but I'm getting :
Error Type:
Microsoft VBScript compilation (0×800A0400)
Expected statement
Here is what I'm using
<MTEntries sort_order="ascend" days="5">
<% adjdate = now()
adjdate = dateadd("h",-5,adjdate)
if (adjdate > cdate("<$MTEntryDate format="%B %e, %Y %I:%M %p"$>")) then response.write %>
<$MTEntryDate format="%B %d, %Y" | %I:%M %p"$><br />
<a href="<$MTEntryLink$>"><$MTEntryTitle$></a><br />
<$MTEntryBody words="20"$><br />
<%end if%>
</MTEntries>
Any ideas?
July 22nd, 2003 at 3:09 pm
For anyone interested in an ASP version of this, I listed one below. Just replace the Scripty version's first red line (in the script above) with this:
<% adjdate = now()
adjdate = dateadd("h",-5,adjdate)
if (adjdate > cdate("<$MTEntryDate format="%B %e, %Y %I:%M %p"$>")) then
response.write
%>
[note the -5 is for me, since my server is 5 hours ahead of my timezone. this number can be adjusted positively or negatively based on where your server resides. I think it will accept a value of zero.]
then replace the second little line of the Scripty code ( the one that looks like this:
(<? } ?>)
with:
<%end if%>
Have fun with ASP now. I know we can't all be PHP people
July 12th, 2003 at 11:11 am
Oeps…
I'm using <MTEntries lastn="10">
With 8 predate postings only 2 entries will be shown. How can a change this MT to show the last 10 not predated postings ?
July 12th, 2003 at 11:09 am
I'm using
With 8 predate postings only 2 entries will be shown. How can a change this MT to show the last 10 not predated postings ?
May 18th, 2003 at 7:08 pm
God bless you.
That's all I can say at this point, after struggling to find the tools I needed to make my calendar blogs work properly. This little bit o' PHP just makes it all sing.
You are an angel. Thanks,
Todd
June 18th, 2003 at 3:45 am
The only place I could find the tag was bloghome/lib/MT/default-templates.pl.
Is that the file into which I should paste the code above?
January 24th, 2003 at 8:26 am
Actually – that sort of makes sense – because those comment tags are only read by the browser… MT, when building the page doesn't care about that… it only understands *it's* tags…
I'll take it out of the code, so no one gets tripped up.
March 27th, 2003 at 9:58 am
hello,
when I publish this is what I geton top of my page:
strtotime ("March 28, 2003 03:50 PM")) { ?>
March 27, 2003
This is the news
news1 …
Continue reading "This is the news"
Posted by pierluigi at 03:50 PM | Comments (0)
any help ?
thanks
Josh
November 8th, 2002 at 3:57 pm
Unfortunately – there probably isn't (at least not with this script). The script isn't really not posting the entry – it's just hiding it depending on the day the page is displayed. It still IS actually there… So it would show up in the RSS feed. :-\ Sorry…
November 14th, 2002 at 4:03 pm
I have tried this in Krisitine's Blogstyles Photoblog Tutorial/Templates
This includes
<MTEntries lastn="30">
The 'future post' works beautifully, except that it includes future posts in the 'n' of 'lastn'. This is disappointing, because I hoped that when I go away, I could set up future posts so that people could see new photos every day.
Is there anyway round that?
November 14th, 2002 at 4:20 pm
Ok, you lost me – you want to email me what your template looks like? The script shouldn't be dependent on any MT tag – except for the DATE tag. It compares the DATE of the POST to the CURRENT DATE (and time) (on the server). lastn="30" shouldn't make a difference, I would think…
November 25th, 2002 at 11:42 pm
Ok I implemented this today for my Two For Tuesday. Didn't get any pasrse errors or anything, but my post before it is missing, and I tried posting another one after the "future" post and that one doesn't show up…am I doing something wrong?
December 8th, 2002 at 10:23 pm
Try changing the strtotime("-3 hours to like +5 or -8 or something. And keep track of the exact hour of your old post and make sure your new post reflects it too for a better reference. It does work.
December 20th, 2002 at 1:48 pm
Wow!
Future posting is indeed the Holy Grail of blogging:
I'm amazed a clean way to do it is not in 2.5.
Only one problem with your solution as far as I can see: future posts are searchable ;(
there goes the element of surprise (!)
any answers?
nice job nonetheless.
January 23rd, 2003 at 11:22 pm
Has anyone noticed that if you include this line in your code, that it means the final MTEntries tag doesn't get parsed?
<!– Make sure you add the next little lines below BEFORE your put your "</MTEntries>" tag. –>
I wasn't sure if anyone had already realized that MT is seeing that </MTEntries> as the closing tag (it didn't affect my test usage of the script, but I'd thought I'd throw it in here anyway).
But I did think it was interesting that, in the final result, that last bit of code isn't really being placed before the actual tag which MT sees as the closing tag (despite instructions to the contrary).
Maybe it doesn't really matter? =)
November 8th, 2002 at 1:39 pm
If you're having problems getting your server to process the code as PHP then your server might also be looking for ASP. Then the server sees <? it could be ASP code or PHP code. To prevent your server from getting confused, always start your code with <?php
November 8th, 2002 at 1:40 pm
Anybody know how to prevent future-dated posts from showing up in your RSS feed?
November 7th, 2002 at 8:35 am
I don't think your trackback counter is working correctly. It shows 0 trackbacks, but I pinged your site last night when I made a future posted entry.
November 7th, 2002 at 8:35 am
Ah, now you're showing 1 trackback. I guess it doesn't show unless the page gets rebuilt.
October 14th, 2002 at 8:46 pm
This is a very cool script. Wish I had found it long ago… only thing is I can't use it in my main blog because I never had the time to convert it to php. Has anyone seen a similar solution that doesn't use PHP?
October 16th, 2002 at 3:34 pm
I did something wrong. My last two posts are pre-posts and they aren't showing up on my main page. you have to view them through the recent entries.
October 13th, 2002 at 11:02 am
Thanks, I'm afraid I don't have the knowledge to get hold of the timestamps, and I wasn't aware of the difference. This is an area where I don't know much about coding so I'll have to leave it to the experts who are so far doing a wonderful job.
October 13th, 2002 at 10:50 am
Since the script only relies on the MTDate tag – it should still work – (that tag should be the same in the new version)
I think the problem with the other code relates to trying to correct the timezone difference (if your server is in a different timezone than you)…
As far as I know, there's a limited number of "variables" you can put in for the strtotime function… "-3 hours" isn't valid. You might try getting the unix timestamp of the entry, the unix timestamp of the server. Get the difference, and if it's greater than (unix timestamp) 3 hours – don't display… If I have time to "play" later I'll try to figure it out.
October 13th, 2002 at 10:34 am
Could it be possible that the script stops working when you switch to the newest version, 2.5, of MT? Because this is the thing that seems to happen to me.
(I should have asked in the support forums, I know…)
October 13th, 2002 at 10:42 am
I'm afraid I can't answer that one, despite upgrading to MT2.5. After posting that the script worked fine, it then turned out that it wasn't working fine at all, so I had to remove it.
September 21st, 2002 at 4:16 am
I've got some bad news for you Kristine, that one wouldn't work either. This one pretty much works the same as the first code, except that if you set certain numbers for the hour difference, entries will pretty much randomly vanish.
September 21st, 2002 at 5:01 am
I have good news, it suddenly struck me to change the time to +6 hours. Originally I'd tried +5, then I remembered American timezones go from 5 hours behind us to 8 hours behind us. +5 hours hid the entry I'd just posted, so I did +6, and the entry appeared. I then set an entry to appear in 3 hours time, and it hasn't shown up on the main page, so I think I may have fixed it.
September 20th, 2002 at 8:05 pm
Okay, I'm a big dummy. I'm also getting the "strtotime ("September 11, 2002 12:00 AM")) { ?>" error like Michael. I just can't figure out how to fix it.
Argh
September 20th, 2002 at 9:42 pm
Okay, this is revised from my post this afternoon – its definitely more likely to work
<?
$time = date("F d, Y h:i A", strtotime("-3 hours"));
$mttime = date("F d, Y h:i A", strtotime("<$MTEntryDate format="%B %d, %Y %I:%M %p"$>"));
if ($time > $mttime)
{
?>
That's just the top red part, make sure you use the whole script with the end red part with this!
For those of you who are seeing the same error that Michael did initially, you might double check that you are using this on a page with an extension of .php – that makes a difference, and if you are actually seeing the code, it is very possible that you don't have php working.
September 20th, 2002 at 3:35 pm
Okay, I got it
<?
if (time() > strtotime ("
September 20th, 2002 at 3:28 pm
Okay, well, tried it out, adding +5 as I figured the site's server being behind must be American (there's nothing between here and there)…unfortunately it just does away with every entry, even the ones 10 days old
September 20th, 2002 at 3:24 pm
Thank you Kristine, it's great that you took the time out to work on this for us
I haven't tested it yet, I'll give it a try
September 20th, 2002 at 3:19 pm
This is untested – just written up with the php.net manual in front of me and MT's manual to compare the date tags, as well as my info from the other thread I posted about time.
For people with time zone issues, you could try replacing the red top code with this:
<?
$time = date("F d, Y h:i A", strtotime("-3 hours"));
$mttime = strtotime("<$MTEntryDate format="%B %d, %Y %I:%M %p"$>");
if ($time > $mttime)
{
?>
You can adjust the -3 hours to whatever amount of adjustment you need. For me, my server is in Tampa, and I'm on the west coast, so that's the amount of offset I need for another script.
September 20th, 2002 at 7:42 am
Thanks Jennifer, that fixed it perfectly. Unfortunately it seems my server is in a different timezone (not sure which) and so both of today's entries have just vanished…ah well
September 20th, 2002 at 7:08 am
If you didn't do anything special to make your html page process like php… my guess is it's not… there's insructions (or at least a LINK to instructions) on how to do that… do a search… it'd be an entry in your htacess file…
September 20th, 2002 at 7:03 am
You may have put your finger on it with the php suggestion, because I've double checked my code and I put it in exactly as you have it. Just a cut and paste job into the right spots.
September 20th, 2002 at 7:00 am
The time zone problem… I think you'd have to figure out the difference between your time and the server time and add/subtract appropriately…
As for the errors – folks, I know this script works, I've had several people test it and are using it without problem. Please check your code. (Or post your problem and perhaps people can help)
September 20th, 2002 at 4:54 am
Looks like I'm also getting
strtotime ("September 18, 2002 09:48 AM")) { ?>
in the resulting page. Too bad because this would be an excellent script. Anyone know the cure for this?
September 10th, 2002 at 5:15 pm
Would have been nice, but I too receive the error of
strtotime ("September 11, 2002 12:00 AM")) { ?>
in the resulting page.
September 14th, 2002 at 4:35 am
Why I am getting a "-1" as result of the strtotime function?
September 10th, 2002 at 5:07 pm
Would have been nice, but I too receive the error of
strtotime ("September 11, 2002 12:00 AM")) { ?>
in the resulting page.
September 5th, 2002 at 4:11 pm
Time zone related problem here.
I'm located in Europe while the server is located in America. So that when I pasted the script into my index template, it even hid the post that was supposed to be there already! Is there any workaround for this issue?
September 2nd, 2002 at 7:32 pm
i have a problem when i post your code. when i rebuild my page it shows "strtotime (september 2, 2002 2:34)". maybe the problems is that i use the dutch version of date notation? maybe something else? please help and keep up the good work!
August 6th, 2002 at 7:47 am
Kymberlie – I just tested that out to be sure… and that wasn't happening to me… perhaps there's some other code in there that's conflicting with it?
If you do one post – date it for the future… then do another post, and it's dated for the present… even if you look at your "edit entries" list, you'll see it orders it by date…so there's no reason why your "prepost" should also show up.
The one thing that I *did* notice is that if there's a "future" post for the same day as a "current" post, the "date header" won't show up until the future post is set to be seen.
You could just put the code below the date header, but then the date header will show up even if you only have ONE post and it's not supposed to be seen yet…
August 5th, 2002 at 8:59 pm
Okay, after messing around with it, I've discovered that if I post another post, the hidden one shows up too – and it's an hour before it's supposed to! Anyone else running into this?
August 5th, 2002 at 7:51 pm
Just noticed something: if you have the "hidden" post it makes the date header go away on my site. In other words, if it's at the top, I don't get a date for the day displayed. This is my code, if you're curious:
<MTEntries>
<?
if (time() > strtotime ("<$MTEntryDate format="%B %e, %Y %I:%M %p"$>"))
{
?>
<$MTEntryTrackbackData$>
<br>
<MTDateHeader>
<div class="dateheader"><H1><b><$MTEntryDate format="%A, %B %e, %Y"$></b></H1></DIV>
</MTDateHeader>
<DIV class="content">
<a name="<$MTEntryID pad="1"$>"></a>
<div class="titlefont"><$MTEntryTitle$><br /></div>
<$MTEntryBody$>
August 5th, 2002 at 7:35 pm
For some strange reason, it appears to be working now. I think it was having a problem with the time I was putting in; if I put a post to show up in like fifteen minutes, it didn't want to work but if I did it to show up in an hour or more it worked (well, they hadn't shown up yet and the "Come back later" was received if trying to hit it through the individual entry page). Thanks again for another kick-ass code!
August 5th, 2002 at 1:27 pm
PS – for those of you that are subscribing to this post/comments… I updated the comment about the individual entries "you're too early" code, and the main post itself… Too much going on when I edited the post the first time… So there was some redundant stuff in there… duh. All better now.
It's also even more compact than before! (Kinda funny when you think about all the work I did originally to get this to work, and now it's essentially ONE LINE!) :-B duh!
August 5th, 2002 at 1:24 pm
Jenn – that was just the explanation I needed; it's working beautifully! Thank you.
As an FYI to anyone who's curious – even though the post does not show up when you "publish", you will ping weblogs.com and the MT site (if you have a registration key) when you change the status to "publish" and the post is pending.
August 5th, 2002 at 1:16 pm
Kymberlie – one thought… without seeing your code it's hard to guess what's happening… but make sure you have the code in the right place… ALL the code is going INSIDE the MTEntries tags now… if you have some of it OUTSIDE, it will probably not work…
August 5th, 2002 at 12:10 pm
Donna – Yes, sorry… should have been more clear… You should follow the instructions almost exactly as I said in the original post… with these few exceptions…
1) obviously, on the individual entries archive, there is no MTEntries tag… so just put the code before where your post is (I'd suggest putting it after the "next/previous" code but BEFORE the date header stuff…
2) at the end… where you're supposed to put those three little lines <? } ?> … instead of those three lines put that other snippet… where you have the "You're too early" etc.
Here's a sample: (some non-relevant code was removed)
<p>
<MTEntryPrevious>
<a href="<$MTEntryLink$>">« <$MTEntryTitle$></a> |
</MTEntryPrevious>
<a href="<$MTBlogURL$>">Main</a>
<MTEntryNext>
| <a href="<$MTEntryLink$>"><$MTEntryTitle$> »</a>
</MTEntryNext>
</p>
<?
if (time() > strtotime ("<$MTEntryDate format="%B %e, %Y %I:%M %p"$>"))
{ ?>
<h2><$MTEntryDate format="%B %d, %Y"$></h2>
<h1><$MTEntryTitle$></h1>
<p><i><$MTEntryDate format="%I:%M %p"$></i></p>
<$MTEntryBody$>
<a name="more"></a>
<$MTEntryMore$>
etc. etc. etc. etc….
</MTEntryIfAllowComments>
<?
} else {
?>
<p>you're too early! Come back at <$MTEntryDate format="%B %e, %Y %I:%M %p"$> to see this post.</>
<? } ?>
(fyi – I updated this comment so that it has the "silly/stupid" extra code removed as well…)
August 5th, 2002 at 10:39 am
Grrrr. I thought I had deleted everything, but it's still not working right for some reason. I'll have to see if I can't figure it out later.
August 5th, 2002 at 10:58 am
Okay, I'm set to post just a few minutes from now – woohoo! Multi-tasking at its finest.
Jennifer, because I'm not understanding it correctly, and I imangine others might need clarification, could you please explain how the "you're too early" code should be implemented? When I installed just that snippet in the standard MT individual entries template, I got a parse error – should I install both "halves" (the "show later" half and the "you're too early" half) of the code in my individual entries template? I also tried replacing the little end code string in the main index template with the "you're too early" code, and it showed up on the page.
Almost there…thank you!
August 5th, 2002 at 10:23 am
Donna – yes. It's a WHOLE lot simpler now.
Kymberlie – I tested it out and I know it works. I'd suggest removing the old code completely and "starting from scratch" with it… perhaps there's a piece that wasn't getting commented out…
August 5th, 2002 at 9:49 am
Okay, it looks like this revised, simplified version no longer needs to go in a header or footer include on every page; you just alter your template, and you're good to go – true? If so, wow.
August 5th, 2002 at 10:17 am
I tried replacing the old script with the new script and commenting out the month function part that was supposed to go in the header and now it seems like it's not working.
August 3rd, 2002 at 8:58 pm
PapaScott – Excellent!! It works! Thanks for the tip! I'm going to update the script in the post. Nice job!
August 3rd, 2002 at 9:16 pm
if anyone can figure out how to control it on the mt calendar or the next/previous entry… let me know. I can't at the moment.
The only thing I can think of for how to "hide" the post is to do something like this on the individual entries template:
at the bottom… where I have just this:
<?
}
?>
change that to this:
<? } else { ?>
<p>you're too early! Come back at <$MTEntryDate format="%B %e, %Y %I:%M %p"$> to see this post.</p>
<? } ?>
August 3rd, 2002 at 1:18 am
Btw, my post showed up at midnight, just like magic.
August 3rd, 2002 at 1:12 am
It looks like I forgot to put the MT tag in quotes, since the argumnet to strtotime needs to be a string. (Hey, I did cover myself by saying 'something like'
So that line should read
if (time() > strtotime ('<$MTEntryDate format="%B %e %Y"$>'))
Both functions do return the number of seconds since Unix was born, so the result can be compared directly.
echo time(): => 1028351148
echo strtotime('July 31, 2002'); =>1028066400
August 2nd, 2002 at 5:18 pm
Oh my gosh, you've found the Holy Grail of blogging
Now all I have to do is start using header and footer includes, and I'm set!
August 2nd, 2002 at 8:03 pm
PapaScott – I just tried your code snippet out but didn't get it to work. Were you able to get that to work?
PHP.net has the definition of time() as follows:
Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
Which isn't the same thing as what you get when you do strtotime()… as far as I know… or maybe I'm doing it wrong…??
August 2nd, 2002 at 1:04 pm
Check out the php function strtotime. The whole routine to check the current time could probably be shortened to something like this:
$displaypost = false;
if (time() > strtotime (<$MTEntryDate format="%B %e %Y"$>))
{
$displaypost = true;
}
August 2nd, 2002 at 11:41 am
Very cool! I've got one set to show up tomorrow so if it does, we know it's working.
Future development idea: is there any way to do it so that you could set a post to show up in an hour on the same day and it work? Say, if I want to make a post at work but I want it to look like I did it after hours instead?
August 2nd, 2002 at 12:12 pm
I just noticed that if you have a calendar where the user can click the date to see the entries, they can see the entries that technically haven't posted yet. Is there a way to hide them on the calendar (you can see what I'm talking about at my site)?
August 13th, 2004 at 5:24 am
Excellent script. But how can a prevent the predated postings to be listed in the rss feeds? I hope anyone can help me with this, pleeeeaaase…