1 Reply Latest reply on Apr 6, 2009 5:01 AM by SujitG

    Social Community Question

    released87
      Hi,

      I have an XML Driven Website that I am going to use as a template. I want to be able to make updates to this one Site so it will automatically update all user sites.

      My goal is to have a website visitor type in www.mydomain.com/user/theusersite, and load up the templated site with their user-specific information.

      My current plan is to have the root folder contain the core template, and have the user-specific directory contain the XML data used to display their Site. I was thinking of having a PHP Script capture the current username, pass the username to the main root application and have it read the XML from that directory.





      //Objects
      private var requestXML:XML= new XML();
      private var loadRequest:HTTPService= new HTTPService();
      private var sendRequest:HTTPService= new HTTPService();
      private var variables:Object= new Object();

      private var _user:String= new String();

      //Methods
      private function sendXML():void {
      _user= "Jesse";
      loadRequest.url= "User/"+_user+"/XML/Test.xml";
      loadRequest.method= "POST";
      loadRequest.resultFormat= "e4x";
      loadRequest.send();
      loadRequest.addEventListener(ResultEvent.RESULT, loadXML);
      }
      private function loadXML(event:ResultEvent):void {
      requestXML= event.result as XML;
      display();
      }
      private function display():void {
      Alert.show(requestXML.user);
      }

      The '_user' variable is the key. I just need to know how I can pass the variable from a PHP page to the SWF. Can I POST the variable to the SWF without requesting the page like I do the XML? Could I use the GET method to pass the username in an URL-encoded string that could be retrieved when the SWF is opened?

      Thanks so much,
      Jesse