Jump to content


Photo

PHP Calendar


  • Please log in to reply
6 replies to this topic

#1 FuG5333

FuG5333
  • Members
  • Pip
  • Newbie
  • 7 posts
  • LocationGreenville, SC

Posted 10 July 2006 - 08:47 PM

Well, so far I've made a calendar and it looks and functions the way I need it to.  The issue is, how do I do something like:  "If it's tuesday, put a link to signup.  But only on Tuesdays."?

#2 micah1701

micah1701
  • Members
  • PipPipPip
  • Advanced Member
  • 613 posts
  • LocationEllington, CT USA

Posted 10 July 2006 - 08:50 PM

I think you could do something like

<?php
$datestamp = n; //wherever you get your date from
if(strtotime("l",$datestamp) == "Tuesday"){ 
//do whatever
}
?>

note: that is a lower case 'L' and not a number "1"
"Confidence in the face of risk."

#3 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 10 July 2006 - 09:11 PM

I think micah meant if(date("l",$datestamp)=="Tuesday") instead of if(strtotime("l",$datestamp) == "Tuesday")
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#4 FuG5333

FuG5333
  • Members
  • Pip
  • Newbie
  • 7 posts
  • LocationGreenville, SC

Posted 10 July 2006 - 09:14 PM

Here's what I have so far.  The error is something about "T_ENCAPSED_AND_WHITESPACE".

<?php
$todaysdate = ".$_SERVER['PHP_SELF']."?date=".mktime(0,0,0,$month -1,$d,$year).";
  if(strtotime("l",$datestamp) == "Tuesday"){
    echo "$todaysdate";
  }
?>

My goal is to get only Tuesdays to show up with a signup link.  This is the first step.  If I can figure how to put something in only Tuesdays, then I get put a link later.  The problem is, I'm trying to eventually save each signup as a 20060610 type of date so the signups can be linked to that date only.  Making sense?

#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 10 July 2006 - 10:19 PM

<?
$date=getdate();

$today_date=$date[weekday];

echo $today_date;

if ($today_date =="Tuesday") {

//add code
}

?>
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 micah1701

micah1701
  • Members
  • PipPipPip
  • Advanced Member
  • 613 posts
  • LocationEllington, CT USA

Posted 11 July 2006 - 01:50 PM

I think micah meant if(date("l",$datestamp)=="Tuesday") instead of if(strtotime("l",$datestamp) == "Tuesday")


I think I meant that too.  oops  :-[
"Confidence in the face of risk."

#7 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 11 July 2006 - 01:54 PM

<?
$date=getdate();

$today_date=$date[weekday];

echo $today_date;

if ($today_date =="Tuesday") {

//add code
}

?>


You need to enclose weekday in single or double quotes, else it's a constant. Like
$today_date=$date['weekday']





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users