Jump to content

Archived

This topic is now archived and is closed to further replies.

tj.baker

Total noob help please......

Recommended Posts

I'm not even entirely sure I need to use PHP exclusivly for what I want to accomplish.

All I want to do is have a seven day list with hours of operation, and have the current day be highlighted.

This sounds fairly simple to me to accomplish..... I just have no idea where to start!

I don't necessarily wish for anyone to completly write the code to do this.... I would at least like to be pointed in the right direction for this particular task (I know I need to get to the php newbies tutorials, and I will!  :))...........I would just like to get this one thing accomplished in a fairly quick timeframe.

Thanks for any input........

peace,

tj

Share this post


Link to post
Share on other sites
Create an array from Sunday to Saturday.
Outut them in as a list (going through each day element)
If the day element is today (i.e. date("l")) then highlight that list.


Share this post


Link to post
Share on other sites
it's not the best way but this should work (i think)

[code]<table>
  <tr>
    <td <?php if (date("D") == "Mon") echo('class="highlight"')?>>Monday</td>
    <td <?php if (date("D") == "Tue") echo('class="highlight"')?>>Tuesday</td>
    <td <?php if (date("D") == "Wed") echo('class="highlight"')?>>Wednesday</td>
    <td <?php if (date("D") == "Thu") echo('class="highlight"')?>>Thursday</td>
    <td <?php if (date("D") == "Fri") echo('class="highlight"')?>>Friday</td>
    <td <?php if (date("D") == "Sat") echo('class="highlight"')?>>Saturday</td>
    <td <?php if (date("D") == "Sun") echo('class="highlight"')?>>Sunday</td>
  </tr>
</table>[/code]

it will add a class "highlight" to the <td> of the current day.

Share this post


Link to post
Share on other sites
[quote author=vbnullchar link=topic=109923.msg443515#msg443515 date=1159510709]
what is it?
[/quote]

Mon  8:00am-3:00pm
Tue  8:00am-3:00pm
Wed  8:00am-4:00pm
Thu    9:00am-4:00pm
Fri      9:00am-2:00pm

All of that in a table, with the current day highlighted.

Thanks for the input!!!

peace,

tj

Share this post


Link to post
Share on other sites
[quote author=chris9902 link=topic=109923.msg443601#msg443601 date=1159527550]
it's not the best way but this should work (i think)

[code]<table>
  <tr>
    <td <?php if (date("D") == "Mon") echo('class="highlight"')?>>Monday</td>
    <td <?php if (date("D") == "Tue") echo('class="highlight"')?>>Tuesday</td>
    <td <?php if (date("D") == "Wed") echo('class="highlight"')?>>Wednesday</td>
    <td <?php if (date("D") == "Thu") echo('class="highlight"')?>>Thursday</td>
    <td <?php if (date("D") == "Fri") echo('class="highlight"')?>>Friday</td>
    <td <?php if (date("D") == "Sat") echo('class="highlight"')?>>Saturday</td>
    <td <?php if (date("D") == "Sun") echo('class="highlight"')?>>Sunday</td>
  </tr>
</table>[/code]

it will add a class "highlight" to the <td> of the current day.
[/quote]

Imma give that one a try!  :)

Thank you very much!!!

peace,

tj

Share this post


Link to post
Share on other sites
have all the dates like <span>Monday</span>  etc; and have your html file parsed into a varriable ($htmlReturn?)
[code]
$htmlReturn = str_replace("<span>" . date("D"), "<span bgcolor=green>" . date("D"), $htmlReturn);
[/code]

ive used that one successfully before :)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.