Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

I neew a panel...

Asked Modified Viewed 2,290 times
S
starefossen
S
www.postexus.com - Follow Postexus on Facebook.
  • Senior Member, joined since
  • Contributed 359 posts on the community forums.
  • Started 20 threads in the forums
  • Started this discussions
asked
Senior Member

Hi, I need a panel. It should show a sertan content each day. Like on monday it should say "Make a new podcast" and on Tuesday it shoud say "Make a new article" an so on all day in the week.
Is this hard to do?


Regards
Starefossen
Edited by starefossen on 13-01-2007 02:22,
0 replies

8 posts

F
fetloser
F
  • Senior Member, joined since
  • Contributed 275 posts on the community forums.
  • Started 2 threads in the forums
answered
Senior Member

It's actually easy!

$whatday = date("w");

this code just tells you what day of the week it is. 0 is sunday and 6 saturday. so just use below code to display anything you like whenever you like.


if($whatday=="0"){
echo"sunday";
}
if($whatday=="1"){
echo"monday";
}

0 replies
S
starefossen
S
www.postexus.com - Follow Postexus on Facebook.
  • Senior Member, joined since
  • Contributed 359 posts on the community forums.
  • Started 20 threads in the forums
  • Started this discussions
answered
Senior Member

Thanx a lot fetloser. Fast replay, thats what I call good support :D :D
0 replies
S
starefossen
S
www.postexus.com - Follow Postexus on Facebook.
  • Senior Member, joined since
  • Contributed 359 posts on the community forums.
  • Started 20 threads in the forums
  • Started this discussions
answered
Senior Member

openside("Ukentlig");
  echo "$whatday = date("w");

if($whatday=="1"){
echo"Mandag";
}
else if($whatday=="2"){
echo"Tirsdag";
}
else if($whatday=="3"){
echo"Onsdag";
}
else if($whatday=="4"){
echo"Torsdag";
}
else if($whatday=="5"){
echo"Fredag";
}
else if($whatday=="6"){
echo"Lørdag";
}
else if($whatday=="0"){
echo"Søndag";
}";
closeside();


What am I doing wrong?
0 replies
Z
Zilvinas
Z
Zilvinas 10
  • Junior Member, joined since
  • Contributed 19 posts on the community forums.
  • Started 2 threads in the forums
answered
Junior Member

Quote

starefossen wrote:
openside("Ukentlig");
  echo "$whatday = date("w");

if($whatday=="1"){
echo"Mandag";
}
else if($whatday=="2"){
echo"Tirsdag";
}
else if($whatday=="3"){
echo"Onsdag";
}
else if($whatday=="4"){
echo"Torsdag";
}
else if($whatday=="5"){
echo"Fredag";
}
else if($whatday=="6"){
echo"Lørdag";
}
else if($whatday=="0"){
echo"Søndag";
}";
closeside();


What am I doing wrong?


Try that, I removed the echo " at the start, and "; at the end. It should work now.
0 replies
F
fetloser
F
  • Senior Member, joined since
  • Contributed 275 posts on the community forums.
  • Started 2 threads in the forums
answered
Senior Member

Exactly, you threw in a few echoes too many :)

openside("Ukentlig");

$whatday = date("w");

if($whatday=="1"){
echo"Mandag";
}

if($whatday=="2"){
echo"Tirsdag";
}

if($whatday=="3"){
echo"Onsdag";
}

if($whatday=="4"){
echo"Torsdag";
}

if($whatday=="5"){
echo"Fredag";
}

if($whatday=="6"){
echo"Lørdag";
}

if($whatday=="0"){
echo"Søndag";
}
closeside();


you can of course remove all the space between lines in the code, that's just for easier viewing here.
Edited by fetloser on 13-01-2007 08:40,
0 replies
S
starefossen
S
www.postexus.com - Follow Postexus on Facebook.
  • Senior Member, joined since
  • Contributed 359 posts on the community forums.
  • Started 20 threads in the forums
  • Started this discussions
answered
Senior Member

Thanx both of you. It's wrking now.. :)
0 replies
M
mel57
M
mel57 10
  • Junior Member, joined since
  • Contributed 10 posts on the community forums.
  • Started 7 threads in the forums
answered
Junior Member

I know this is a simple code, but not knowing a lot about php yet,
how does date("w"); get the actual day of the week?
thanks
0 replies
W
WEC
W
WEC 10
  • Veteran Member, joined since
  • Contributed 946 posts on the community forums.
  • Started 5 threads in the forums
answered
Veteran Member

It's taken from server time setting.

You can read more on in the php manual on which format you can use and what the returned values will be:

http://www.php.net/manual/en/function...n.date.php
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 8 posts
  • Votes 0 votes
  • Topic users 5 members

0 participants

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet