Changing a server-side script to client-side

If it is not too much work, can anyone edit the embedded php code so that it functions as client-side js? php.php
ddantesAsked:
Who is Participating?
 
EyalCommented:
have you installed php? without it you will not be able to run files with php extention
I personally use http://www.wampserver.com/en/

regarding the javascript

create javascript tag like so

<script>
var fpslideshowvar={
baseurl: "http://SERVER_NAME/PHP_SELF/",
images: [
[1, "filename", "filedate"],
[2, "filename", "filedate"],
["placeholder"]
],
desc: []
}
</script>

Open in new window

you should alter the list of files and the baseurl
0
 
EyalCommented:
this code is investigating the file structure of the server so client side can replace it.
the final result is javascript
0
 
ddantesAuthor Commented:
Thank you for your comment.  Can you supply the final result javascript?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
EyalCommented:
the output of this page will be something like this (json style)

var fpslideshowvar={
baseurl: "http://SERVER_NAME/PHP_SELF/,
images: [
[1, "filename", "filedate"],
[2, "filename", "filedate"],
["placeholder"]
],
desc: []
}

Open in new window

0
 
ddantesAuthor Commented:
Thank you for providing that code.  It looks like only the last third of the php code is included in your output.  May I ask what happens with the code section which begins: function returnimages($dirname=".") {  
etc.?
0
 
EyalCommented:
this is the code that will run on the server to generate the

[1, "filename", "filedate"],
[2, "filename", "filedate"],
["placeholder"]
0
 
ddantesAuthor Commented:
Eyal: Thank you for your explanation.  Please excuse my ignorance -- I was hoping to eliminate any server-side code, and to run exclusively client-side code.  Is that possible?
0
 
EyalCommented:
if you know the list of files in advance sure
why do you want to cancel this code and convert it to javascript only without server side?
0
 
ddantesAuthor Commented:
I do know the list of files in advance.  Using php is difficult for me. I can't test the page on my local drive.  And if I try to call the php page in an iFrame, my browser asks me if I want to open or save the file, but never displays it.
0
 
ddantesAuthor Commented:
Thank you for your help.  The wampserver which you recommended -- will that allow me to run php scripts on my windows desktop?
0
 
EyalCommented:
yes and also mysql
0
 
ddantesAuthor Commented:
Very helpful to know.  I'll try it today.
0
 
ddantesAuthor Commented:
I installed Wampserver 2.2a.  It doesn't appear to have a help file.  I selected my default browser.  Still can't open php files.  Any hints?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.