updwebmaster Posted December 10, 2007 Share Posted December 10, 2007 My calendar system is based on an iframe inside of a php page. I'm trying to get the page to automatically change the default calendar for the month using the date(n) string. This is my current code for the page: <?php $month = echo date(n); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Language" content="en-us" /> <title>Calendar</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="CSS/calendar.css" /> <style type="text/css"> .style1 { text-align: center; } .style2 { border: 1px solid #ff0000; background-color: #000000; } .style3 { font-size: xx-large; } .style4 { text-align: left; } #menuShow{ border: 1px solid #666666; background-color: #111111; padding: 13px; font-size: 13px; font-family: Verdana, Arial; position: absolute; width: auto; height: auto; } #menuSelect{ border: 1px solid #666666; background-color: #111111; padding: 13px; font-size: 13px; font-family: Verdana, Arial; position: absolute; width: auto; height: auto; } </style> <script type="text/javascript" src="js/menu.js"></script> </head> <body style="color: #FFFFFF; background-image: url('images/star_wars_battlefront_2_913200514441pm902.jpg')"> <div id="menuSelect"> <a href="#" onClick="moveOnMenu();moveOffSelector()"> <center> <img src="images/UPD%20symbol.jpg" width="26" height="26" border="0" /> <font size="1pt"> <br />navbar </font> </center> </a> </div> <div id="menuShow"> <a href="#" onClick="moveOffMenu();moveOnSelector()"> <img src="images/UPD%20symbol.jpg" width="40" height="40" border="0" /><br />Click To hide this menu </a> <br /> <iframe src ="Navbar/Navbar.htm" style="width: 270px; height: 278px" id="Navbar" frameborder="0" scrolling="no"> </iframe> </div> <div id="masthead" class="style1"> <table style="width: 100%" class="style2"> <tr> <td class="style3">Calendar</td> </tr> </table> </div> <div id="top_nav"> </div> <div id="page_content" class="style1"> <table style="width: 100%" class="style2"> <tr> <td valign="top" class="style4">Below is the calendar for upcoming events in {UPD}. Admins and members, you will be notified by e-mail of upcoming meetings.<p class="style1"> <iframe src ="Calendars/<?php $month ?>.htm"> Your browser does not support inline frames or is currently configured not to display inline frames. </iframe> </p></td> </tr> </table> </div> </body> </html> This is the page: http://www.uberpilotdudes.com/Calendar.php What's wrong with my code? I'm kinda new to php so I need help. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted December 10, 2007 Share Posted December 10, 2007 Change $month = echo date(n); To $month = date(n); ---------------------------- Change <iframe src ="Calendars/<?php $month ?>.htm"> To <iframe src ="Calendars/<?php echo $month; ?>.htm"> So your files are named like 1.php, 2.php, etc, right? Quote Link to comment Share on other sites More sharing options...
updwebmaster Posted December 10, 2007 Author Share Posted December 10, 2007 Actually, their named 1.htm, 2.htm, etc. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted December 10, 2007 Share Posted December 10, 2007 Actually, their named 1.htm, 2.htm, etc. Oops, sorry...thats what I meant Quote Link to comment Share on other sites More sharing options...
updwebmaster Posted December 10, 2007 Author Share Posted December 10, 2007 ok I was looking at putting a "case" string in the php so that I could make my navbar so that it would automatically bring up a certain month in that iframe... do you know how to do that? the problem is that I tried another one earlier and it didn't work. I don't have the script with me now. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted December 10, 2007 Share Posted December 10, 2007 Did you try changing what I told you to? ok I was looking at putting a "case" string in the php so that I could make my navbar so that it would automatically bring up a certain month in that iframe... do you know how to do that? the problem is that I tried another one earlier and it didn't work. I don't have the script with me now. Your going to have to explain that a little more... Quote Link to comment Share on other sites More sharing options...
updwebmaster Posted December 10, 2007 Author Share Posted December 10, 2007 Did you try changing what I told you to? ok I was looking at putting a "case" string in the php so that I could make my navbar so that it would automatically bring up a certain month in that iframe... do you know how to do that? the problem is that I tried another one earlier and it didn't work. I don't have the script with me now. Your going to have to explain that a little more... I'm trying to make my calendar so that it will have links to have a specific month to appear in the iframe located on the php page using the "?" after the address. I used another code that allowed me to use something like this in the address bar. http://www.uberpilotdudes.com/Calendar.php?action=1 I was wondering if you know how to do a code like that. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted December 10, 2007 Share Posted December 10, 2007 You could do this <?php if (isset($_GET['action'])) $month = $_GET['action']; else $month = date(n); ?> Now if action is set in the URL, it will display that month. If there is no action, it will display the current month by default. Is that what your after? Quote Link to comment Share on other sites More sharing options...
updwebmaster Posted December 10, 2007 Author Share Posted December 10, 2007 You could do this <?php if (isset($_GET['action'])) $month = $_GET['action']; else $month = date(n); ?> Now if action is set in the URL, it will display that month. If there is no action, it will display the current month by default. Is that what your after? what would a URL look like for that? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted December 10, 2007 Share Posted December 10, 2007 Just like you already put http://www.uberpilotdudes.com/Calendar.php?action=1 Quote Link to comment Share on other sites More sharing options...
updwebmaster Posted December 10, 2007 Author Share Posted December 10, 2007 alright! cool thanks for the help! 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.