KillerWolf Posted November 22, 2006 Share Posted November 22, 2006 hey guys iam new to php just started about 1 month ago, noticed this forum was very popular found lots of answers to problems i was having but now iam stuck. what iam trying to do is use the date function along with an array to output a new hyperlink every month. what i understand so far is that i need an array of course, and then also declare the getdate() method. what i have is this so far<?php $todays_date = getdate(); $linkoftheday = array( 1 <= '<a href=\"http://nitrofire.net/forum\">');?> then in a css layer i have this<?PHP if ($linkoftheday==$todays_date) echo $linkoftheday; else { echo 'fail'; }?>i know for a fact iam missing a bunch of stuff but i am stuck on finding more information on this. anyhelp would be greatly appreciated.thanks KillerWolf Quote Link to comment Share on other sites More sharing options...
ober Posted November 22, 2006 Share Posted November 22, 2006 You might get more help in the right board!EDIT: Please use more descriptive titles in the future. Thanks! Quote Link to comment Share on other sites More sharing options...
taith Posted November 22, 2006 Share Posted November 22, 2006 ok... thats just WAY too complicated for what your trying to do...[code]<?$linkoftheday[1] = '<a href="http://nitrofire.net/forum">';$linkoftheday[2] = '<a href="http://nitrofire.net/forum">';ect...echo $linkoftheday[getdate()];?>[/code] Quote Link to comment Share on other sites More sharing options...
KillerWolf Posted November 22, 2006 Author Share Posted November 22, 2006 k fixed the error echo $linkoftheday[getdate()];toecho $linkoftheday['getdate()'];but none of the links showbut with the coded arrays dont you have to declare that they are an array before the $linkoftheday[1] = '<a href="http://nitrofire.net/forum">'; ????? Quote Link to comment Share on other sites More sharing options...
taith Posted November 22, 2006 Share Posted November 22, 2006 nope! great thing bout arrays$array[]='';is exactly the same as$array = array('');are you doing this for day of the week? month? or year... because php date function makes life sooo easy like thatweek = date(N); <-- 1-7month = date(j); <-- 1-31year = date(z); <-- 0-365[code]<?$linkoftheday[1] = '<a href="http://nitrofire.net/forum">';$linkoftheday[2] = '<a href="http://nitrofire.net/forum">';ect...echo $linkoftheday[date(z)];?>[/code] Quote Link to comment Share on other sites More sharing options...
KillerWolf Posted November 22, 2006 Author Share Posted November 22, 2006 iam doing months 1 - 31 Quote Link to comment Share on other sites More sharing options...
KillerWolf Posted November 22, 2006 Author Share Posted November 22, 2006 [quote author=taith link=topic=115949.msg472276#msg472276 date=1164227038]nope! great thing bout arrays$array[]='';is exactly the same as$array = array('');are you doing this for day of the week? month? or year... because php date function makes life sooo easy like thatweek = date(N); <-- 1-7month = date(j); <-- 1-31year = date(z); <-- 0-365[code]<?$linkoftheday[1] = '<a href="http://nitrofire.net/forum">';$linkoftheday[2] = '<a href="http://nitrofire.net/forum">';ect...echo $linkoftheday[date(z)];?>[/code][/quote]ya but with the array i thought it had to be $linkoftheday[2] = array ('<a href="http://nitrofire.net/forum">'); Quote Link to comment Share on other sites More sharing options...
taith Posted November 22, 2006 Share Posted November 22, 2006 nope....[code]<?$linkoftheday[0] = '<a href="http://nitrofire.net/forum"></a>';...$linkoftheday[365] = '<a href="http://nitrofire.net/forum"></a>';echo $linkoftheday[date(z)];?>[/code]every different day will give you a new link... considering that $linkoftheday[#] is set... try it... it'll work :-) Quote Link to comment Share on other sites More sharing options...
KillerWolf Posted November 22, 2006 Author Share Posted November 22, 2006 i must be doing somthing wrong heres my code, iam assuming it has to due with the $linkoftheday not being set like you said, but how do i set that to work with the date function. iam more familure with Java.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Modders Back Door</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><style type="text/css"><!--@import url("style2.css");--></style></head><body><?php $linkoftheday[0] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[1] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[2] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[3] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[4] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[5] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[6] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[7] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[8] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[9] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[10] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[11] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[12] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[13] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[14] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[15] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[16] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[17] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[18] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[19] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[20] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[21] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[22] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[23] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[24] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[25] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[26] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[27] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[28] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[29] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[30] = '<a href="http://nitrofire.net/forum">'; $linkoftheday[31] = '<a href="http://nitrofire.net/forum">';?> <ul> <li><a href="index.htm">Home</a></li> <li><a href="linuxmods.php">Linux modds</a></li> <li><a href="windows.php">Window modds</a></li> <li><a href="contact.php">Contact Us</a></li> </ul><!--ULR of the day --><div id="ULRDAY"></div> <div id="banner"><img src="photos/banner.jpg"></img> </div> <div id="Contentindex"><p class="headermain">Welcome to the Modders backdoor</p> <p class="modpagefontcolor"> I created this site because of my love of computers and modding them. i like to take something and make it even better then it was. With in this site i will be posting a lot of my modds that i have done. later i will even be making a forum for we all can post our updates and others work on modding. If you wish to have your project on this site please go to the contact page for further information.<br><br>KillerWolf <br> <br> <br> <img src="photos/secondheader.jpg"></a> <p class="Contentindex"> <p class="modpagefontcolor">Currently on the site, we have Pencutise a case modd done by running Fedor 5 dis. of Linux.</a> <div id="linuxmainpage"> <br> <br> <p class="linuxholder"><img src="photos/linuxpic2a.jpg"></a></p> </div> <br> <br><br> <br><br> <br><br> <br> <!--<img src="photos/blank_header.jpg"></a>--> <br> <br></p> </p><?echo $linkoftheday['date(z)'];?> </div></body></html> Quote Link to comment Share on other sites More sharing options...
KillerWolf Posted November 22, 2006 Author Share Posted November 22, 2006 nevermind i fixed it lol thx so much Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.