[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

How can I randomly select a img to start display?

Asked by lapucca in PHP Scripting Language, Hypertext Markup Language (HTML)

I need to randomly select the 1st picture to start displaying from the file path folder at "C:\Inetpub\wwwroot\ctsi\media\images\homeCycleImages2";.  So, let say randomly, the 3rd file is selected to display as the 1st img then after that, the 4th and 5th and then back to 1, 2 3..  will be cycle through in displaying.  How do I modify the following php code to do this?  thanks.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
<?php
	//full error reporting & display
	ini_set('error_reporting',E_ALL);
	ini_set('display_errors',1);
	//end error reporting
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Clinical Translational Science Institute (CTSI) - USC, CHLA, COH</title>
<style type="text/css">
.slideshow { height: 250px; width: 450px; margin: auto }
.slideshow2 { height: 250px; width: 450px; margin: auto }
</style>        
 
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<link rel="stylesheet" href="http://www.labctsi.org/newcss/basic.css" type="text/css" />
<link rel="stylesheet" href="http://www.labctsi.org/newcss/site.css" type="text/css" />
<link rel="stylesheet" href="http://www.labctsi.org/newcss/layout.css" type="text/css" />
 
<!-- Css styles for main menu (Superfish + jQuery) -->
 
<link rel="stylesheet" type="text/css" href="http://www.labctsi.org/newcss/superfish-dropdown.css" media="screen" />
 
<!-- Javascript and initialization of main menu (Superfish) -->
<script type="text/javascript" src="http://www.labctsi.org/js/jquery.js"></script> 
<script type="text/javascript" src="http://www.labctsi.org/js/hoverIntent.js"></script> 
<script type="text/javascript" src="http://www.labctsi.org/js/superfish.js"></script>
<script type="text/javascript" src="http://www.labctsi.org/js/supersubs.js"></script>
<script type="text/javascript" src="http://www.labctsi.org/js/jquery.cycle.all.js"></script>
 
<!-- Initialise main menu (Superfish) -->
<script type="text/javascript"> 
	$(document).ready(function()
	{
				$('.slideshow').cycle({
						fx: 'fade',
						speed: 1000, 
                                                timeout:  2000 
				});
				$('.slideshow2').cycle({
						fx: 'fade',
						speed: 5000
				});
		
		$("ul.sf-menu").supersubs({ 
		minWidth:    8,   // minimum width of sub-menus in em units 
		maxWidth:    25,   // maximum width of sub-menus in em units 
		extraWidth:  0     // extra width can ensure lines don't sometimes turn over 
						   // due to slight rounding differences and font-family 
	}).superfish();
				$('#core_Search').attr('action', 'http://www.labctsi.org/index.php');                   
		}); 
 
</script>
</head>
<body class="homePage">
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr valign="top">
            <td align="left" bgcolor="#000000"><a href="http://www.usc.edu"><img src="http://www.usc.edu/usc/img/01/usc-name-lightgray-black.gif" alt="University of Southern California" width="255" height="25" border="0"/></a></td>
            <td width="50" rowspan="2" align="left" bgcolor="#990100"><a href="http://www.usc.edu"><img src="http://www.usc.edu/usc/img/01/mono-gold-cardinal-med.gif" alt="" width="65" height="50" border="0" /></a></td>
    </tr>
        <tr valign="top">
 
            <td align="left" bgcolor="#990100"><a href="http://www.labctsi.org/"><img src="http://www.labctsi.org/media/images/title.gif" width="475" height="25" border="0" /></a></td>
    </tr>
</table>
 
        <div id="wrapper">
            <div id="header">
                <a href="http://www.labctsi.org"><img src="http://www.labctsi.org/media/images/logolabctsi.gif"/></a>
                <ul id="utilityLinks">
                <li><a href="http://www.labctsi.org/Membership.aspx/Apply"><img src="http://www.labctsi.org/media/images/ctsimember.png" /></a></li>
                </ul>
            </div>
        	<div id="mainNavigation">
        
        <ul class="sf-menu">
                <li>
                        <a href="http://www.labctsi.org/">Home</a>
                </li>
                <li>
                        <a href="#">Centers</a>
 
                        <ul>
                <li><a href="http://www.labctsi.org/index.php/about_cct/">Community</a></li>
                                <li><a href="http://www.labctsi.org/index.php/about_cetcd/">Education</a></li>
                <li><a href="http://www.labctsi.org/index.php/about_chs/">Human Studies</a></li>
                                <li><a href="http://www.labctsi.org/index.php/cbis/">Informatics</a></li>
                                <li><a href="http://www.labctsi.org/index.php/cst">Scientific Translation</a></li>
 
                        </ul>
                </li>
                <li>
                        <a href="#">Programs</a>
                        <ul>
                <li><a href="http://www.labctsi.org/index.php/about_ethics/">Ethics</a></li>
                                <li><a href="http://www.labctsi.org/index.php/about_rdg/">RDG</a></li>
 
                                <li><a href="http://www.labctsi.org/index.php/about_regulatory/">Regulatory</a></li>
                        </ul>
                </li>
                <li>
                        <a href="#a">Resources</a>
                        <ul>
                                <li><a href="#">Community</a></li>
 
                                <li><a href="#">Education</a></li>
                                <li><a href="http://www.labctsi.org/index.php/resources/core_facilities">Research Cores</a></li>
                        </ul>
                </li>
                <li>
                        <a href="#a">Applications</a>
                        <ul>
 
                                <li><a href="http://www.labctsi.org/index.php/feasibility_application_2009">Feasibility Grant Program 2009</a></li>
                        </ul>
                </li>
        </ul>           
</div>
<br/>
<div id = prototype>    
    <CENTER>
            <table cellspacing="10"><tr><td>    
                <div id="curtain"  class="slideshow">
                        <?php
                        $dir = "C:\Inetpub\wwwroot\ctsi\media\images\homeCycleImages1";
 
                        // Open a known directory, and proceed to read its contents
                        if (is_dir($dir)) {
                                if ($dh = opendir($dir)) {
                                        while (($file = readdir($dh)) !== false) {                      
                                                if ($file != "." && $file != "..") {
                                                      
                                                      echo "<img src='http://www.labctsi.org/media/images/homeCycleImages1/".$file."'  width='450' height='250' />";
                                                }
                                        }
                                        closedir($dh);
                                } else {
									echo "<div>Unable to open dir, check permissions.</div>";
								}
                        } else {
							echo "<div>Dir does not exist.</div>";
						}
                        ?>
                </div>
     </td><td>
                <div id="fade"  class="slideshow2">
                        <?php
                        $dir = "C:\Inetpub\wwwroot\ctsi\media\images\homeCycleImages2";
 
                        // Open a known directory, and proceed to read its contents
                        if (is_dir($dir)) {
                                if ($dh = opendir($dir)) {
                                        while (($file = readdir($dh)) !== false) {                      
                                                if ($file != "." && $file != "..") {
                                                      
                                                      echo "<img src='http://www.labctsi.org/media/images/homeCycleImages2/".$file."'  width='450' height='250' />";
                                                }
                                        }
                                        closedir($dh);
                                } else {
									echo "<div>Unable to open dir, check permissions.</div>";
								}
                        } else {
							echo "<div>Dir does not exist.</div>";
						}
                        ?>
                </div>
        </td></tr>      
        </table>
   </CENTER>
</div>
        
 
 
                <br class="clear" />
                <div id="mainContent">
                        <div id="secondaryNavigationColumn">
                            <ul>
                    <li><a href="http://www.labctsi.org/index.php/feasibility_grant_program_2009">Pilot Grant Program 2009 - Announcement</a></li>
                                <li><a href="http://www.labctsi.org/index.php/feasibility_application_2009">Pilot Grant Program 2009 - Applications</a></li>
 
                                </ul>
                        </div>
                        <div id="informationColumn">
                                <p>The NIH has created a national consortium that will transform how clinical and translational research is conducted, ultimately enabling researchers to provide new treatments more efficiently and quickly to patients. Led by NCRR, this new consortium, funded through Clinical and Translational Science Awards (CTSAs), begins with <a href="http://www.ncrr.nih.gov/clinical_research_resources/clinical_and_translational_science_awards/consortium_directory/index.asp">several Academic Health Centers</a> (AHCs) located throughout the nation. Additional AHCs are receiving planning grants to help them prepare applications to join the consortium.</p>
                                <p>When fully implemented in 2012, about 60 institutions will be linked together to energize the discipline of clinical and translational science. The new program draws on NIH's earlier initiatives to re-engineer the clinical research enterprise, one of the key objectives of the NIH Roadmap for medical research.</p>
                                <p>The <a href="http://www.nih.gov/news/pr/oct2006/ncrr-03.htm">NIH News Release</a> and the CTSA Questions and Answers offer additional information on the consortium. CTSA Grant Awardees have agreed to post part of their <a href="https://www.ctnbestpractices.org/networks/nih-ctsa-awardees/">applications</a> for public viewing.</p>
 
                        </div>
                        <div id="newsAndEventsColumn">
                                <h1 id="newsHeading">Recent News</h1>
                                <ul>
                                  <li><span class="date">June 15, 2009</span><br/><a href="http://www.labctsi.org/site/news/webinar_course_on_researcher_commercialization/">Webinar Course on Researcher Commercialization</a></li>
                                  <li><span class="date">February 04, 2009</span><br/><a href="http://www.labctsi.org/site/news/new_la_basin_ctsi_initiative/">New Los Angeles Basin CTSI Initiative</a></li>
                                  <li><span class="date">February 03, 2009</span><br/><a href="http://www.labctsi.org/site/news/american_medical_informatics_association_amia/">AMIA Informatics Webinars </a></li>
                                </ul>
                                <h1 id="eventsHeading">Upcoming Events</h1> 
                                <ul>
                                </ul>
                        </div>
                </div>
                <div id="footer">
                	<a href="#">Terms of Use</a> | <a href="https://usc.centraldesktop.com/login" target="_blank">Central Desktop</a> | <a href="http://www.labctsi.org/system" target="_blank">Content Management</a> | <a href="http://mail.labctsi.org" target="_blank">Email</a> | <a href="http://calendar.labctsi.org" target="_blank">Calendar</a> | <a href="#" target="_blank">Videos</a>
                </div>
        </div>
</body>
</html>
[+][-]11/05/09 07:15 PM, ID: 25756338Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: PHP Scripting Language, Hypertext Markup Language (HTML)
Sign Up Now!
Solution Provided By: yauhing
Participating Experts: 1
Solution Grade: A
 
[+][-]11/05/09 04:15 PM, ID: 25755584Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/05/09 04:16 PM, ID: 25755585Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/05/09 07:09 PM, ID: 25756318Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 11:33 AM, ID: 25762325Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/06/09 12:10 PM, ID: 25762618Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 12:44 PM, ID: 25762871Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625