Jump to content


Photo

if date then do this if not go do that.... ????? Grrrrrr!!!!


  • Please log in to reply
3 replies to this topic

#1 Mouse

Mouse
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts
  • LocationToo Close to LONDON

Posted 05 September 2006 - 01:31 PM

Ok, I am a total lose where to start with this… maybe I am being a little too cleaver for my own good, or perhaps I am just too dumb today to work this out for myself…

What I have is two lists:
One is a list of quotes, and their speakers,
The other is a list of “on this day” and the relevant years.

What I am aiming to do is…

If
there is a listing for today in this list then put “what happened” in box “a” and ‘On this day’ and the year in box “b”
else
put random quote in box “a” and site the speakers name in box “b”

at the moment I am part way there on my homepage with the quote part (see http://mouse.nodstrum.com/index.php) but I just cant get my head around how to get the if’s and else’s to make this work….

HELP

(pretty please)

Mouse

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 05 September 2006 - 01:35 PM

List?  Like an array, like something in a database or textfile? Maybe we need to see what you have already as code and that'll help make this easier to understand (from the viewpoint of what help, pretty or otherwise, you need)
Legend has it that reading the manual never killed anyone.
My site

#3 Mouse

Mouse
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts
  • LocationToo Close to LONDON

Posted 05 September 2006 - 01:53 PM

to be honest, what ever works best... all the quotes are in a txt file and i'm just writing the on this day file but using Excel for ease of keeping it all together... so i am open...

Quote:
<?php
// Array Structure:  "Quote","Author"

$allqts = array
    (
"You can create the most wonderful place in the world. But it takes people to make the dream a reality. - Walt Disney",
"You may not realize it when it happens, but a kick in the teeth may be the best thing in the world for you. - Walt Disney",
"It's not hard to make decisions when you know what your values are. - Roy Disney",
"There's no good idea that can't be improved on. - Michael Eisner",
"Succeeding is not really a life experience that does that much good. Failing is much more enlightening. - Michael Eisner",
"Well, when you're trying to create things that are new, you have to be prepared to be on the edge of risk. - Michael Eisner"
        );

$totalqts = (count($allqts)/2);

$nmbr = (rand(0,($totalqts-1)));
$nmbr = $nmbr*2;

$quote = $allqts[$nmbr];
         $nmbr = $nmbr+1;


echo "<Font color=$textcolor>";
echo "$quote<br>";
echo "</font>";


IF ($PHP_SELF == "/quotes.php") {
    show_source("quotes.php");
   }

?>

(and thanks for the interest...)

Mouse

#4 Mouse

Mouse
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts
  • LocationToo Close to LONDON

Posted 05 September 2006 - 01:58 PM

i think i should also point out that while the site is mone, i tend to do mostly the design side and let my coding partner do the back end bits... but pride is getting to me and i need to do some of the coding myself...

Mouse




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users