FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » 6 line php 2 asp
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: 6 line php 2 asp [message #176954 is a reply to message #176948] Thu, 09 February 2012 03:06 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Wed, 08 Feb 2012 13:40:42 -0800, Pettt[CZ] wrote:

> Guys, this is your humble ASP colleague asking for help. I have no
> experience with PHP and I need this 6 line page translated to ASP
>
> $location = 'albums';
> $album_name = $_GET['album_name'];
> $files = glob($location . '/' . $album_name . '/*.{jpg,gif,png}',
> GLOB_BRACE);
> $encoded = json_encode($files);
> echo $encoded;
> unset($encoded);
>
> it comes from here:
> http://tympanus.net/codrops/2010/06/27/beautiful-photo-stack-gallery-
with-jquery-and-css3/
> but I honestly would not know where to start
>
> No cross-subject violation meant, just shopping where the knowledge
> is...
> Sorry, and thanx again

See Jerry's comments - I can try and explain what I think the code does,
but (a) I might be wrong and (b) I know nada about ASP.

It seems to be generating a json encoded list of pathnames of all files
matching 3 popular image types in a subdirectory of "albums" that was
passed as a parameter in a get request.

The following pages should help you work your way through understanding
the php:

1) $_GET[] http://uk.php.net/manual/en/reserved.variables.get.php
2) glob() http://uk.php.net/manual/en/function.glob.php
3) string concatenation http://uk.php.net/manual/en/
language.operators.string.php
4) json_encode() http://uk.php.net/manual/en/function.json-encode.php
5) echo http://uk.php.net/manual/en/function.echo.php
6) unset http://uk.php.net/manual/en/function.unset.php

Basically, the file expects a get request that looks something like:

http://server/path/page?album_name=dirname

then given files in: "albums/dirname" with the names:

file1.gif
file2.gif
file3.jpg
file4.png
file5.png
file6.jpg

I believe that the response will look something like:

{0:"albums/dirname/file1.gif",1:"albums/dirname/file2.gif",2:"albums/
dirname/file3.jpg",3:"albums/dirname/file4.png",4:"albums/dirname/
file5.png",5:"albums/dirname/file6.jpg"}

But that's the best I can offer you.

This might give you enough of an understanding to write the equivalent
ASP code, or it might not.

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Headers in fpassthru() output
Next Topic: Query or Array functions
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 00:29:55 GMT 2024

Total time taken to generate the page: 0.04739 seconds