Hello.
I'm not sure where to put this.
I want to add my own code to the front page of my efiction site,
but I'm not sure how to make the code work.
I know nothing about PHP, and I was hoping someone here could help me?
<?
$quote = array(
1 => "<b>Grissom</b>: Can you smell that?<BR><b>Doc Robbins</b>: Yeah.<BR><b>Grissom</b>: You're not supposed to be able to smell that through your suit.<BR><b>Doc Robbins</b>: I'll keep that in mind.",
2 => "<b>Catherine</b>: We're mid-case. Why do we have to do this now?<br><b>Grissom</b>: Well, unless I get these evaluations in, I'll be written up.<br><b>Catherine</b>: My goals... all right, for starters, I'd like two consecutive nights off. I would like to cut my triples down to 10 instead of the usual 20, and I would love to find a reliable babysitter so I could have myself some kind of a personal life.<br><b>Grissom</b>: You don't have a personal life?<br><b>Catherine</b>: Write this down, I haven't had sex in six - no, seven months.<br><b>Grissom</b>: How can I help?<br>[Her eyes widen]<br><b>Grissom</b>: You. Advance, I mean.",
3 => "<b>Grissom</b>: I was flying to a seminar in New Hampshire a couple of summers ago. I was sitting in the plane next to a Philosophy Professor from Harvard. He told me this story about how every morning he takes a leak right after his three-hour philosophy class. He flushed the toilet there'd be this tiny brown spider fighting for its life against the swirling water. He came back the next day, flush. Same spider, clawing its way back from oblivion. A week goes by, he decides to liberate the spider. Grabs a paper towel, Scoops him up and sets him on the floor in the corner of the stall. Comes back the next day and what do you think happened to the spider?<br><b>Warrick</b>: Dead.<br><b>Grissom</b>: On his back, eight legs up. Why? Because one life imposed itself on another. Right then I realized, where we stand. For the first time I understood our role. We don't impose our will. We don't impose our hopes on the evidence.",
4 => "<b>Nick</b>: There's a sucker born every minute.<br><b>Grissom</b>: Yeah, and they all come to Vegas.",
5 => "<b>Sara</b>: So what is it?<br><b>Hodges</b>: Give me some time, I'm not a miracle worker.<br><b>Sara: Well, that's obvious, Hodges, or else you wouldn't be rude.<br><b>Hodges</b>: I wasn't being rude, I was being curt. Rude would be 'When I know, you'll know.' Friends?<br><b>Sara</b>: No.",
6 => "<b>Sara</b>: Clothing, $85. Earrings, $30. Latte, $4. Getting away with murder...<br><b>Grissom</b>: ...Priceless.",
7 => "<b>Grissom</b>: Sara, do you have any duct tape in your kit?<br><b>Sara</b>: Yeah. It's what I use to hold it together.",
8 => "<b>Greg</b>: I'm like a sponge: I just absorb information.<br><b>Grissom</b>: I thought that was MY line.<br><b>Greg</b>: Yeah, and I absorbed it.",
9 => "[liquid from the trunk of a car containing two corpses splashes up onto Greg's face and into his mouth]<br><b>Sara</b>: Technically, that makes you a cannibal. Grissom would be proud.<br><b>Greg</b>: Grissom would have tasted it on purpose.",
10 => "<b>Catherine</b>: What kind of perverse game are you playing here, Gil?<br><b>Grissom</b>: I'm not a pervert.",
12 => "<b>Grissom</b>: And what are you doing about it now?<br><b>Sara</b>: Going back to the girl. I left her in the car.</b> [Everyone looks horrified] <b>But the windows are cracked...</b> [All still dumbfounded] <b>Give me a little credit. She's at the hospital.</b> [All faces show relief]",
);
srand ((double) microtime() * 1000000);
$randnum = rand(1,12);
echo"$quote[$randnum]";
?>
How do I make this work? I tried just to copy and past that, but it just showed up all in one jumbled mass.
Thanks,
SSS
Version of PHP: 5.2.8
Version of MySQL: 5.0.67
Ah AH! the randome quotes! Let me check how I did that on mine and I'll post it here.
Okay, here we go. Make the PHP code you want to use its own file like... call it quotes.php if you want or something you'll know what it is. Then, in the index.tpl file, input that code where you want the quote block to appear:
<!-- INCLUDESCRIPT BLOCK : ./quotes.php -->
That's worked for me as you can see on http://fanfics.suethomasfbeye.net/index.php?skin=supernatural
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
OP, your code won't work. You need to backslash the double quotes like this:
1 => "<b>Grissom</b>: "Can you smell that?"<BR><b>Doc Robbins</b>: "Yeah."<BR><b>Grissom</b>: "You're not supposed to be able to smell that through your suit."<BR><b>Doc Robbins</b>: "I'll keep that in mind."",
π
archive:
site:
Available for skin/mod commission! π
Thank you mucho. π (P.S. - The quotes in the code I put in the original post was a mistake, I took them out in my code that I was using, but accidentally pasted them here).
I'm gonna try it out on the efiction site, but wondered if you guys think it would work the same if i put it on my regular site? Or is that different code?
Version of PHP: 5.2.8
Version of MySQL: 5.0.67
Nevermind!
I figured it out!
<?php include("quotes.php"); ?>
Thanks again!
Version of PHP: 5.2.8
Version of MySQL: 5.0.67
