Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Changing a server-side script to client-side

Posted on 2011-10-16
13
Medium Priority
?
239 Views
Last Modified: 2012-05-12
If it is not too much work, can anyone edit the embedded php code so that it functions as client-side js? php.php
0
Comment
Question by:ddantes
  • 7
  • 6
13 Comments
 
LVL 15

Expert Comment

by:Eyal
ID: 36976721
this code is investigating the file structure of the server so client side can replace it.
the final result is javascript
0
 

Author Comment

by:ddantes
ID: 36976737
Thank you for your comment.  Can you supply the final result javascript?
0
 
LVL 15

Expert Comment

by:Eyal
ID: 36976904
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:ddantes
ID: 36976951
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
 
LVL 15

Expert Comment

by:Eyal
ID: 36976958
this is the code that will run on the server to generate the

[1, "filename", "filedate"],
[2, "filename", "filedate"],
["placeholder"]
0
 

Author Comment

by:ddantes
ID: 36977031
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
 
LVL 15

Expert Comment

by:Eyal
ID: 36977037
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
 

Author Comment

by:ddantes
ID: 36977063
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
 
LVL 15

Accepted Solution

by:
Eyal earned 2000 total points
ID: 36977087
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
 

Author Comment

by:ddantes
ID: 36977097
Thank you for your help.  The wampserver which you recommended -- will that allow me to run php scripts on my windows desktop?
0
 
LVL 15

Expert Comment

by:Eyal
ID: 36977126
yes and also mysql
0
 

Author Comment

by:ddantes
ID: 36977141
Very helpful to know.  I'll try it today.
0
 

Author Comment

by:ddantes
ID: 36977230
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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question