Jump to content

parboy

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

parboy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks, I was going in that direction, i.e., defining the variables for each event and then stringing the conditional statements. My skills with arrays are limited, so it was helpful to see how you handled that aspect. It's working now.
  2. That's pretty much the code I've written. The conditional statements are all based on the event's expiration date which is defined: $exp_date = "2011-05-09"; The special text is also defined for each event: echo "<h2>Special Event #1</h2>"; I had intended to repeat the conditional test for each event with a string of "elseif" conditional statements, but it doesn't work. I think one problem is how to reset the exp_date within a conditional statement.
  3. I am trying to select text to display on condition of the current date. I've set a Unix timestamp for the current date: <?php $todays_date = date("Y-m-d"); $today = strtotime($todays_date); ?> Next I test for the first condition. I want the text to appear for 2 weeks then terminate: <?php $exp_date = "2011-05-09"; $expiration_date = strtotime($exp_date); $start_date = strtotime("-14 days", $expiration_date); if ($start_date < $today && $expiration_date > $today) { echo "<h2>Special Event #1</h2>"; } elseif { At this point, I want to set the exp_date for the next event and test again, but I don't know how to do it. The techniques I've tried appear to evaluate as false and display the default text which follows the final "else": } else { echo "<h2>Default Text</h2>"; } ?>
  4. I want to use a conditional statement to determine which include should be used based on whether the statement evaluates true or false. I think it's a matter of syntax but I haven't figured out the correct form. It seems to get more complicated with variables inside the includes. Example: <? if($issue_number=="n") { echo "<?php include 'issues/'."$nl_issue[$nl-1]".'.php'; ?>"; } else { echo <?php include 'issues/'."$nl_issue[$issue_number]".'.php'; ?>"; } ?>
  5. It was procedural, I had the definition of $folder below the conditional statement. Problem solved, thanks for your help.
  6. I've moved the first part above the DOCTYPE, i.e., <?php $bios = '<script type="text/javascript" src="/js2/accordion.js"></script>'; $other = '<script type="text/javascript" src="/js/accordion.js"></script>'; ?> and left the conditional statement near the bottom of the head: <?php if($folder == 'bios') { echo "$bios"; } else { echo "$other"; } ?> Still points to ../js.. regardless of $folder value. So... how would I set it as a session element? TO PFMaBiSmAd: I wrote ../js2.. but meant ../js.. Sorry about the typo.
  7. That's what I thought too, but when I use the comparison sign (==) it outputs the 2nd value (../js2..) even when $folder == 'bios'. NOTE: I have the $folder value print at the bottom of the page to check the condition.
  8. I'm a newbie and can't get this If else statement to work. It's supposed to point to a file named "main_menu.js" in one of 2 folders (/js or/js2) depending on the current page - what's wrong?? <?php $bios = '<script type="text/javascript" src="/js2/main_menu.js"></script>'; $other = '<script type="text/javascript" src="/js/main_menu.js"></script>'; if($folder = 'bios') { echo "$bios"; } else { echo "$other"; } ?>
×
×
  • 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.