School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store | FORUMS
(#494 2004-02-05 06:23:40) Post Reply |
|
ScriptME
|
Oops I forgot to also ask, what would happen if each category had a different number of elements? How would I use count then, b.c if one Array had 5 elements and another 2, then this could cause problems.
Thanks, ScriptME |
(#495 2004-02-05 06:24:34) Post Reply |
|
ScriptME
|
Oops I forgot to also ask, what would happen if each category had a different number of elements? How would I use count then, b.c if one Array had 5 elements and another 2, then this could cause problems.
Thanks, ScriptME |
(#540 2004-03-04 23:57:06) Post Reply |
|
slinky
|
|
(#562 2004-03-23 08:38:12) Post Reply |
|
Emdec
|
2 files in the same directory -
(This does not actually rotate the banners but picks a random one on loading. I hope that this is what is required.) Week4.inc |
(#568 2004-03-28 00:39:49) Post Reply |
|
slinky
|
/*dunno what went wrong b4 maybee i entered something wrong ohwell
bannerarray.php*/
|
(#596 2004-05-25 12:57:41) Post Reply |
|
Beauchy
|
Main file
|
(#609 2004-05-30 21:39:30) Post Reply |
|
ice52us
|
i guess mine is the shortest one. i do not have a url, because im doing this on some local server, which allows me to view it without uploading it, and i do not want to take the time to.<br>main one.
|
(#634 2004-06-09 23:07:16) Post Reply |
|
fishhead
|
here is the array file
working file is http://www.southfloridajams.com/php/week4.php |
(#636 2004-06-10 06:40:46) Post Reply |
|
Ahkorahil
|
I have a noobic question and feel shame about it, but how to enter clickable url below your homeassignment, when I want to post it into forum?
thanks for help |
(#641 2004-06-12 14:13:52) Post Reply |
|
madhatter
|
Ahkorahil, hey,
you should just have to enter the url, just type it out, the bulletin board automatically reads it as a url http://www.yourdomain.com |
(#642 2004-06-12 14:40:56) Post Reply |
|
Ahkorahil
|
madhatter
Thanks for help! :D But now I don't know where to hide my hide :P shame on me I try: http://www.noob.com |
(#643 2004-06-12 14:41:39) Post Reply |
|
Ahkorahil
|
correction:
to hide my eyes* |
(#683 2004-07-31 09:07:25) Post Reply |
|
MI4C
|
*******My index.php*******
<? require("extrapages/random_banner.php"); /*get the banner*/ ?> *******My random_banner.php******* <? /* I try something difficult and maybe working... */ $images_path = '../images'; $banners = array("eng.gif", "sve.gif", "fin.gif"); $links = array('www.helsinki.fi/university', 'www.helsinki.fi/universitetet', 'www.helsinki.fi/yliopisto'); mt_srand(time()); $random_index = (mt_rand(1, (count($banners))) - 1); print("<a href=\"http://$links[$random_index]\"> <img src=\"$images_path/$banners[$random_index]\"></a>"); /* After 2 hour thinking and working I finally got it working, but not like I wanted... Does anyone know how to get that annoying link round away from the picture... I still want that the link exists, without the link around it... */ // Well this was my 3rd own script... ?> |
(#689 2004-09-10 12:39:14) Post Reply |
|
lestat
|
Woohoo, This was easy compared to the #3 advanced with the multidimensional assignment.
However, I did have to look back now and then for the proper syntax..... Index page:
...and it works too! |
(#708 2004-10-05 11:18:21) Post Reply |
|
Marcel
|
Ok..here we go :
require-file :
Going advanced now.... |
(#770 2005-02-27 09:43:48) Post Reply |
|
LowenWolfe
|
Here are my Week #4 scripts:
The "required" script:
LowenWolfe |
(#777 2005-03-06 10:43:17) Post Reply |
|
zman
|
My Basic Assignment #4:
|
(#811 2005-05-04 11:35:21) Post Reply |
|
vegyta2004
|
I have the following script:
<HTML> <BODY> <?require("D:\PROGRAME INSTALATE-FUNCTIONALE\PHP Designer 2005\proiecte d'ale mele\random_quote"); ?> </BODY> </HTML> The random_quote file is: <? $pictures=array("D:\week4\poza_1.jpg","D:\week4\poza_2.jpg","D:\week4\poza_3.jpg","D:\week4\poza_4.jpg","D:\week4\poza_5.jpg"); mt_srand(time()); $random_index=mt_rand(1,count($pictures)-1); print("<img src=\"$pictures[$random_index]\">"); ?> It gives me the following error: Warning: main(D:\PROGRAME INSTALATE-FUNCTIONALE\PHP Designer 2005\proiecte d'ale mele andom_quote) [function.main]: failed to open stream: Invalid argument in C:\Documents and Settings\VLADUT ON LICEENI\My Documents\_debug_tmp.php on line 3 Fatal error: main() [function.require]: Failed opening required 'D:\PROGRAME INSTALATE-FUNCTIONALE\PHP Designer 2005\proiecte d'ale mele andom_quote' (include_path='.;C:\php5\pear') in C:\Documents and Settings\VLADUT ON LICEENI\My Documents\_debug_tmp.php on line 3 Can someone help me????? |
(#812 2005-05-05 11:51:37) Post Reply |
|
vegyta2004
|
I have solved my problem.
here is a file called random_quote.php: HTML> <BODY> <? //week 4 basic: $pictures=array("D:\week4\poza_1.jpg","D:\week4\poza_2.jpg","D:\week4\poza_3.jpg","D:\week4\poza_4.jpg","D:\week4\poza_5.jpg"); mt_srand(time()); $random_index=mt_rand(1,count($pictures)-1); print("<img src=\"$pictures[$random_index]\">"); ?> </BODY> </HTML> This is the file that uses random_quote: <?include("random_quote.php") ?> My mistake was that I put the adress of the file in the require function,and did not put the file in the root directory. After i had put the name of the file in the require function and the file In the root directory,the program worked. PS:I used some photos instead of banners |
(#823 2005-05-22 12:17:21) Post Reply |
|
DarePoo
|
Working URL: http://www.adr-clan.com/phplea...assignment4.php
banner file (banners.php): |
(#850 2005-08-09 08:56:52) Post Reply |
|
MaLeK
|
<?php //ASSIGNMENT 4 BASIC
mt_srand(time()); $random_index=(mt_rand(1,(count($banners)-1))); $banners=array('banner0.jpg','banner1.jpg','banner2.jpg','banner3.jpg','banner4.jpg'); print("<img src="$banners[$random_index]">"); //we will call this file assign4basic.php3 so we can require it. //wherever you need this random banner rotation you type: //<? require("path/to/$assign4basic.php3*"); ?> |
(#851 2005-08-09 09:02:51) Post Reply |
|
MaLeK
|
on my last post i forgot to say what the problem was. the images did not rotate. it stayed on the first one. however, when i type in 0,4 then it rotates fine, so i think its something wrong with the count function...but it looks good to me..soo, i don't know.
oh and even weirder, when i type both the (0,4) script and this script at the same time, it gives me side by side images, and they rotate exactly the same. im wondering how this is dependent on the other script with (0,4). any ideas? <?php //ASSIGNMENT 4 BASIC mt_srand(time()); $random_index=(mt_rand(1,(count($banners)))-1); $banners=array('banner0.jpg','banner1.jpg','banner2.jpg','banner3.jpg','banner4.jpg'); print("<img src=\"$banners[$random_index]\">"); ?> |
(#853 2005-08-09 10:30:54) Post Reply |
|
MaLeK
|
ok i now know that the problem was that the array was not defined before the count function. thanks lestat! |
(#885 2005-11-03 22:31:28) Post Reply |
|
Goudarzi
|
Main Script
|
(#886 2005-11-03 22:34:04) Post Reply |
|
Goudarzi
|
Main Script
|
(#887 2005-11-04 11:08:57) Post Reply |
|
TDavid
|
To see what you are talking about, try adding a loop to check the randomizations webgourdarzi like this and notice what numbers you see:
Compare the results. |
(#913 2005-12-30 02:23:33) Post Reply |
|
Dylan
|
http://www.babyian.com/psi/homework.php
First rndbanner.php contains my array: |
(#940 2006-02-17 01:26:45) Post Reply |
|
prezbedard
|
ok one minor typo but fixed it
I used the state flags of New England as my subject. the reqiure file |
(#948 2006-02-21 18:47:42) Post Reply |
|
anti
|
here is file #1 start page that calls the script
|
(#983 2006-03-28 04:48:54) Post Reply |
|
DrgnLdy
|
I'm missing something here but can not for the life of me figure out what it is...probably something real simple that I am overlooking...any help would be greatly appreciated
|
View Previous Thread Print This Page |
School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store
Advertising
| Link To Us | Privacy
Copyright 2000-2002 Script School Productions / KMR
Enterprises
No part of this website may be reproduced, copied and/or distributed
in any medium
without express written permission