NameSilo

Some php howto?

SpaceshipSpaceship
Watch

whyme953

Established Member
Impact
1
hi,

i am trying to do as follows:
i have some info that changes every week, every week i would like to display that weeks info.
i'm not sure if this is the best way to go about it but what i was thinking is to use the file () function with a list of every weeks info.
what do i need to do in order to display a different element of the array each week? (the correct one for that week)

thanks.
any help is greatly appreciated.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
sorry i meant to say that the week numbers go from monday to monday not that they start their week on monday.

Originally posted by iDeviseFlash
so whats your problem if they have added it for you?
who added what?
 
0
•••
PHP, with the W, lol.
 
0
•••
i dont think i'm following you... i dont think you're following me...
that W is the format character to get the week number with the date function

echo date ("W"); // prints the week number
 
0
•••
yes, but it says on the link that it starts with monday right? im gonna go back and look.
 
0
•••
i am really not following you, i have no idea what you're trying to say...
 
0
•••
How do you want the start and end times changed according to the week? I mean if it is the 13th week of the year what would you want the start and end times to be? And what about the 14th week? Or do you plan to define each different thing for each week in an array with 52 values?
 
0
•••
actually i'm basically done but i'll post my script to explain what i was trying to do (i'm very proud of myself, i just finished my first real php script)

i dont expect to be the one updating the times next year so i left alot of notes.
PHP:
 <?php
     // the following sets the week to this weeks number
$weeknumber = date("W");  //gets the current week number
$dayofweek = date ("D");  //gets the current day
	
//this makes sure sunday gets counted as the current week
//not the previous week.
     if ($dayofweek==Sun)
	{
	$weeknumber++ ;
	}
	
//this script gets this weeks info
include  ("$weeknumber".".php") ;
	
//in case for some reason i dont update next year in time
     if ($weeknumber<27) print "under construction";
	
     //the following sets up the high holiday times
     //still needs to be formatted
     elseif ($weeknumber==38) // week of Rosh Hashanah
	{
	print "this week is Shabbos parshas $parsha,<br />
	rosh hashanah is on thursday and friday,<br />
	candle lighting times are as follows:<br />
	wed. sept. 15, 29 Elul, at 6:55 pm<br />
	thu. sept. 16, 1 Tishrei, after 7:57 pm<br />
	fri. sept. 17, 2 Tishrei, at $starts pm <br />
	Shabbos ends at $ends pm.<br />
	Sun sept. 19, 4 Tishrei is the fast of Gedaliah<br />
	fast begins at 5:35 am and ends at 7:42 pm";
	}
     elseif ($weeknumber==39) //week of yom kippur
	{
	$sunday="today is the fast of Gedaliah.<br />
	fast ends at 7:42 pm<br />";
	$restofweek= "This week is shabbos $parsha.<br />
	light candles<br />
	fri. $fridayEn, $fridayHe, at $starts<br />
	Yom Kippur ends saturday night at $ends pm";
		
          if ($dayofweek==Sun) print "$sunday"."$restofweek";
		
          else print $restofweek	;			
     }
		
     else   //for all the regular weeks
     {
          print
           "<table width=\"220\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
        <tr> 
          <td height=\"30\" colspan=\"2\"> 
            <div align=\"center\" class=\"candleweek\">Shabbos Parshas 
              $parsha</div></td>
        </tr>
        <tr> 
          <td width=\"163\" class=\"candlelightend\">Light Candles</td>
          <td width=\"57\"> </td>
        </tr>
        <tr> 
          <td height=\"26\" class=\"candletimeday\">fri. $fridayEn, $fridayHe,</td>
          <td valign=\"top\"><div align=\"center\" class=\"candletimeday\">$starts</div></td>
        </tr>
        <tr> 
          <td class=\"candlelightend\">Shabbos Ends</td>
          <td> </td>
        </tr>
        <tr> 
          <td class=\"candletimeday\" height=\"30\">Shabbos night</td>
          <td valign=\"top\"><div align=\"center\" class=\"candletimeday\">$ends</div></td>
        </tr>
      </table>" ;
	  }
	  ?>

here's a samle of a weeks info:
PHP:
<?php
$parsha = "Balak";  //this weeks parsha
$starts = "8:22";   //shabbat starts
$ends = "9:25";     //shabbat ends
$fridayEn = "july 2nd";  //english date
$fridayHe = "13 Tammuz";  //hebrew date
?>
 
Last edited:
0
•••
nice man. glad you could do it! *claps*
 
0
•••
%U - week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week


but congrats on your first piece of code, now wish I wuld get my arse into gear and do the coding i keep meaning to do.
 
0
•••
Originally posted by filth
%U - week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week
thanks.
i guess i should've payed a bit more attention to your previous link.
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
NameMaxi - Your Domain Has Buyers
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back