php if else show statement - date dependent like. show if date=Dec. 2, 2010 or less than?
I updated my photo-gallery framewor开发者_开发百科k recently. But I still need the old 'javascript files' in stories older than a certain date, eg: Dec. 2, 2010. (stories are in CMS/dynamic)
I was thinking of an "if else" statement, but can't get it right.
if date(Dec. 2, 2010) < CURDATE() {
show this (which is the older JS files) ; }
else {
show the new javascript files; }
I don't like having to load both of the JS files if I don't need to (for speed sake).
Thanks in advance.
<?php
if (time() > strtotime('2010-12-02')) {
echo '<script type="text/javascript" src="/js/highslide/highslide.js"></script>
<link rel="stylesheet" type="text/css" href="/js/highslide/highslide.css" />
<script type="text/javascript">
hs.graphicsDir = "/js/highslide/graphics/";
hs.wrapperClassName = "wide-border";
hs.showCredits = false;
</script>';
}
else {
echo 'old stuff';
}
Something along the line of
if date(Dec. 2, 2010) < CURDATE() {
<script src="old_js.js" />
else {
<script src="new_js.js" />
精彩评论