4 Replies Latest reply on Nov 15, 2010 11:29 AM by Devtron

    One html request to a script or many?

    flexillu10 Level 1

      I am planning to have a Tree structure which will be used to browse a library of thumbnail images.

       

      When the user clicks the categories they want to view, i.e Sport->football do i need to a separate HTML request and PHP script to handle this request, or one PHP script that handles all requests.

       

      I'm thinking the one script makes sense, would i need to send the user clicked items as parameters. So search my database for all images matching sport and football?

        • 1. Re: One html request to a script or many?
          kraikit

          This is not specifically a Flex question, but you could do either approach. For code maintainability, though, I'd suggest you create one PHP script that handles all of your requests of this type. The script would take the appropriate parameters (e.g. "...&searchCategory=Sport,football") and then return the corresponding results.

           

          -- Tom

          Flex SDK engineer

          • 2. Re: One html request to a script or many?
            flexillu10 Level 1

            Thanks you, my next question is more flex releated i hope!

             

            My php is currently passing back XML data to my air app, mainly a url of an illustrator file to be downloaded and opened.

             

            This is working well, however is it possible for the PHP to download the file and pass it to flex somehow? Can flex handle this?

             

            At the moment the files are at a publically accesible url like: 'http://someserver/files/file1.ai'

             

            But i want to stop the files from being accessed say in a browser and only accessed through my app. Is there a way to do this?

             

            Have i missed the point in storing my files in the web root of my server?

            • 3. Re: One html request to a script or many?
              kraikit Level 2

              Hi,

               

              Well, that's not necessarily Flex-related either. Yes, your PHP can handle the request from the Flex app, read the appropriate XML file from the filesystem (or even from another machine/URL if necessary), then send the XML back to the Flex app in the HTTP response. For example, here's an article that describes a simple version using a JSP instead of PHP: http://cookbooks.adobe.com/post_Building_Flex_Applications_with_JSPs-7746.html .

               

              It sounds like you need to look into PHP documentation to get to where you want to go.

               

              HTH,

               

              -- Tom

              Flex SDK engineer

              • 4. Re: One html request to a script or many?
                Devtron Level 3

                flexillu10 wrote:

                 

                At the moment the files are at a publically accesible url like: 'http://someserver/files/file1.ai'

                 

                But i want to stop the files from being accessed say in a browser and only accessed through my app. Is there a way to do this?

                 

                Have i missed the point in storing my files in the web root of my server?

                 

                 

                To hide the files from direct browser access, you would have to setup some type of security/permission protocol on your web server. This varies from server to server, depending on the TYPE of server you are using. This is not done through FLEX, that I know of.

                 

                Also, Ive never heard of "HTML requests". Maybe that is something in PHP, since I am ignorant to PHP.

                 

                My guess is that you need to fire off some type of HTTP REQUEST for every tree node click, from the FLEX UI. Your data access technology is up to you, but the FLEX tree can easily fire off events from the node level.