Jump to content

dylandcor

Members
  • Posts

    23
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

dylandcor's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I realize that now. Sorry. But it works perfectly! Thanks!!!
  2. I have a staff page that has all the information contained in arrays. It also contains a short bio about each person answering questions, this data is in an array too. When I go to echo this data, it echos this in the actual page: $Smith['0']. This is what I actually wanted to echo, you can see below how this is generated. It assigns the correct name to the person, so that isn't the problem. Any help would be greatly appreciated! $last_names=array('Smith', 'Jones', 'Anderson'); $Smith=array('Answer 1', 'Answer 2', 'Answer 3'); foreach($lastname as $staffmember){ echo "Question 1: $$lastname[$i]['0'] <br> Question 2: $$lastname[$i]['1'] }
  3. I solved it myself. I found the difference and checked whether it was positive or negative.
  4. I use this in a registration form so that the form remembers the value if there is an error. When it passes a certain time, $closed_oakdale, I would like one of the options to disappear. The form values don't seem to switch no matter what time I put. It always seems that $now is always less than $closed_oakdale. I can't seem to figure out what is wrong, but I'm sure it's simple. Sorry for my lack of knowledge. Any help would be greatly appreciated! <?php $now= strtotime('now'); $closed_oakdale= strtotime('July 06, 2009 23:02:15'); if($now < $closed_oakdale) { $arr = array('Select a Campus', 'Oakdale', 'Bridgeville'); } if($now > $closed_oakdale){ $arr = array('Select a Campus', 'Bridgeville'); } for($i2 = 0; $i2 < count($arr); $i2++) { if(isset($campus)){ $selected = ($arr[$i2] == $campus) ? 'selected="selected"' : ''; }else{ $selected = ($arr[$i2] == $arr[0]) ? 'selected="selected"' : ''; } echo "<option value=\"{$arr[$i2]}\" {$selected}>{$arr[$i2]}</option>\n"; } ?>
  5. I have a script that creates an xml podcast file on the fly after the audio is uploaded. The administrator enters some information and then it is done. The file is set up to mimic the iTunes specifications. When the file is created, I used file_get_contents to add the new audio to the old ones. Since the newest is at the top, I made the php file create the channel information each time as well. I was wondering if there was some way to delete the old channel information so there aren't two copies. I tried preg_replace, but I keep getting this error: Hopefully this makes sense. What I tried in the php file: $myFile = "rss/new_file.xml"; $myFile2 = "rss/new_file.xml.bak"; copy ($myFile, $myFile2); $contents = file_get_contents ($myFile); $patterns = "<?xml version=\"1.0\"?>"; #$patterns = "<rss xmlns:itunes=\"http://www.itunes.com/dtds/podcast-1.0.dtd\" version=\"2.0\">"; #$patterns = " <channel>"; #$patterns = " <title>title</title>"; #$patterns = " <link>url</link>"; #$patterns = " <description>desc</description>"; #$patterns = " <itunes:author>url</itunes:author>"; #$patterns = " <itunes:image href=\"url\"/>"; #$patterns = " <itunes:category text=\"None\">"; #$patterns = " <itunes:category text=\"test\"/>"; #$patterns = " </itunes:category>"; #$patterns = " <copyright>2009</copyright>"; #$patterns = " <lastBuildDate>Sun, ".$lastbuilddate2." 00:00:00 -0500</lastBuildDate>"; #$patterns = " <itunes:explicit>No</itunes:explicit>"; $replacements = ' '; echo preg_replace($patterns, $replacements, $contents); This is what I get in the podcast file. I wanted to remove the second channel info before I add the new entry: <?xml version="1.0"?> <rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"> <channel> <title>title</title> <link>url</link> <description>desc</description> <itunes:author>author</itunes:author> <itunes:image href="url"/> <itunes:category text="None"> <itunes:category text="test"/> </itunes:category> <copyright>2009</copyright> <lastBuildDate>Sun, 12 Apr 2009 00:00:00 -0500</lastBuildDate> <itunes:explicit>No</itunes:explicit> <item> <title>title</title> <pubDate>Sun, 26 April 2009 00:00:00 -0500</pubDate> <enclosure url="url" length="xxxxxxxx" type="audio/mpeg"/> <guid>url</guid> <description>desc</description> <itunes:duration>42:03</itunes:duration> <itunes:keywords>keywords</itunes:keywords> </item> <?xml version="1.0"?> <rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"> <channel> <title>title</title> <link>url</link> <description>desc</description> <itunes:author>author</itunes:author> <itunes:image href="url"/> <itunes:category text="None"> <itunes:category text="test"/> </itunes:category> <copyright>2009</copyright> <lastBuildDate>Sun, 12 Apr 2009 00:00:00 -0500</lastBuildDate> <itunes:explicit>No</itunes:explicit> <item> <title>title</title> <pubDate>Sun, 26 April 2009 00:00:00 -0500</pubDate> <enclosure url="url" length="xxxxxxxx" type="audio/mpeg"/> <guid>url</guid> <description>desc</description> <itunes:duration>42:03</itunes:duration> <itunes:keywords>keywords</itunes:keywords> </item> <item> <title>title</title> <pubDate>Sun, 26 April 2009 00:00:00 -0500</pubDate> <enclosure url="url" length="xxxxxxxx" type="audio/mpeg"/> <guid>url</guid> <description>desc</description> <itunes:duration>42:03</itunes:duration> <itunes:keywords>keywords</itunes:keywords> </item>.......
  6. Thank you SO much for sticking with me. I really appreciate it! Problem solved.
  7. This is what came up: Array ( [0] => ./documents/agendas/Leader030809.doc [1] => ./documents/agendas/Leader031509.doc [2] => ./documents/agendas/Leader032209.doc [3] => ./documents/agendas/Leader032909.doc [4] => ./documents/agendas/Leader041209.doc )
  8. Thank you for your quick reply. Your code seems to be working except one tiny thing. It links to Leader041000.doc? Any suggestions? This is my current code $files = glob('./a/b/Leader*.doc'); $newest = 0; foreach ($files as $file) { $filename = basename($file); //construct standard date (yyyy-mm-dd) from filename $stddate = '20' . substr($filename, 10, 2) . '-' . substr($filename, 6, 2) . '-' . substr($filename, 8, 2); //if file's date is more recent than the most recent yet, update the most recent $newest if (strtotime($stddate) > $newest) { $newest = strtotime($stddate); } } $last_date = date('mdy', strtotime($newest)); $sunday = date('mdy', strtotime('last sunday')); if (file_exists("./a/b/Leader$sunday.doc")){ $leader = "<a href='http://www.domain.com/a/b/Leader$sunday.doc'>Leader Questions</a>"; }else{ $leader = "<a href='http://www.domain.com/a/b/Leader$last_date.doc'>Leader Questions</a>"; }
  9. I have a code that checks if a particular word document exists. The content gets updated most weeks and the word documents have the form LeaderMMDDYY.doc. Is there any way to extend this script so that if a file doesn't exist, it will create a link to the most recent file going back week by week until it finds one? All I would need it to change would be $last date. I know that this script is laziness at it's finest, but it would make my life easier. $last_date = "032909"; //This is what I need to change with the loop. $sunday = date('mdy', strtotime('last sunday')); if (file_exists("../a/b/Leader$sunday.doc")){ $leader = "<a href='http://www.domain.com/a/b/Leader$sunday.doc'>Leader Questions</a>"; }else{ $leader = "<a href='http://www.domain.com/a/b/Leader$last_date.doc'>Leader Questions</a>"; } Any suggestions would be greatly appreciated. Thanks!
  10. Thank you for the reply. Problem solved!
  11. I have a folder of Word Documents that are updated weekly. There are 2 documents changed per week. I want to get the last two updated so that all I have to do is upload new ones to change the links to them. Each set of 2 contains one LeaderMMDDYY.doc and one MemberMMDDYY.doc where MMDDYY is the date for that week. Is there any way to do this so I get the latest Leader and Member document? Any help would be appreciated. This is what I tried: $getLastModDir = filemtime("documents/agendas/"); $getLastModDir_output -= 24 * 60 * 60 * 1;
  12. Thank you so much all of you for all your help. Problem Solved
  13. Thank you for your quick replies! I have done what you both said and cleaned my code up. It is still however... Not working. I had the index echo the $page variable and it does do the correct one. index.php <?php $page="index"; echo $page; include ("http://www.mysite.com/header.php"); ?> I then have the header.php echo the $page variable which does not work. header.php <?php if (!isset($page)) { echo "DOES NOT EXIST"; #I am getting this when I load the page which proves that the variable does not exist? } #Start Content Here if ($page=="index"){ $html="Index"; $htmlsidebar=""; }else{ $html="Other Site"; } echo $page; echo $html; ?>
  14. I want to dynamically generate content based on where a user is in my site. I set a variable $page in the index page before I included header.php with the following code in it. The header.php cannot seem to find the $page variable. Any help would be greatly appreciated. index.php <?php $page="index"; include ("header.php); ?> header.php <?php if ($page=="index"){ $html="<b>WELCOME TO THE INDEX"; $htmlsidebar=""; }else{ $html="<tr>"; echo $html; ?>
×
×
  • Create New...

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.