New to the boards and php/flash question

Discussion in 'Web Design and Development' started by wastemyday, May 12, 2008.

  1. wastemyday macrumors newbie

    May 12, 2008
    Hi everyone,

    I am a graphic designer who has been put into the role of a web designer. I've learned flash/html/some AS, but know absolutely nothing about php.

    My question is this:

    I'm trying to use a flash file of an image slideshow made by another developer. The images aren't placed in the timeline of the flash movie, but are instead located in a file folder on the website's server.

    The actionscript uses a references a php file, which in turn references the image folder to draw from:

    images_xml = new XML();
    images_xml.ignoreWhite = true;
    images_xml.onLoad = parse;

    Now, I'm trying to use that same flash file for a sister site, employing new images, but i can't seem to get the php file to properly reference my new file with images.

    For a bit of clarification, the first three lines in the php file say:

    $rootdir = ' ';

    $imagesdir = 'images/front';

    $basedir = $rootdir.$imagesdir;

    I have made sure that my new file is called "front" and is located in the image directory, but no dice...

    Also, when i drag the entire current working site onto my local drive, the flash slideshow draws a blank on images, and is no longer able to reference them. This leads me to believe it's a confusion with the paths, but since I have no idea how php works, i thought maybe someone more experienced/talented/awesome than me could shed some light on this.

    Sorry for the massively long first post, but I'm happy to finally join the boards here!

    Thanks in advance!
  2. SrWebDeveloper macrumors 68000


    Dec 7, 2007
    Alexandria, VA, USA
     $rootdir = ' ';
    $imagesdir = 'images/front';
    $basedir = $rootdir.$imagesdir;

    The code above sets a variable arbitrarily named $rootdir to a single space, then sets another variable $imagesdir to what should be the path to the collection of image files, relative to the current directory. Then the third line sets another variable to concatenate the first with the second.

    Note: I am thinking you added a single space into $rootdir when typing your post, spaces aren't used in paths typically so is that really intended to be blank?? I will assume so in my reply.

    So in that example, $basedir sets a path relative to the current directory (whatever that is for you) containing a sub-directory called images, then a sub-directory inside of that called front.

    Solution 1:

    I think you need to create the above structure (not a file called front) and put all your graphic files inside of the front directory. I say this because front has no file extension, and that means it is intended to be directory.

    So why was $rootdir added in the code at all? That looks like generic code where the author makes it convenient for developers to define a physical path instead of a relative path which you're using now.

    Here is an example of a physical path configuration:

    $imagesdir = 'images/front';
     $basedir = $rootdir.$imagesdir;
    Then $basedir has a value of "/home/username/public_html/images/front" and since it's a physical path, it'll work no matter where its referenced.

    Of course all that can be combined into one elegant statement using a global variable that stores the document root for you in memory:

    Solution 2:

    There are a few exceptions where the global variable is not supported, but it works for nearly all servers and keeps your code portable if you switch servers. Of course, relative paths are always universally compatible.

    Expect varying methods from users replying to this, there are countless other ways to accomplish the same, and if you supply us with your document root path we can tell you exactly what to set for those 3 variables. I covered relative vs. physical paths since the generic code invites both methods for the developer. I prefer using solution 2.

  3. wastemyday thread starter macrumors newbie

    May 12, 2008
    Wow thanks for the lengthy reply! Sorry I had some trouble with my login, so I haven't been able to respond.

    I'm a little embarrassed, but I'm not sure exactly what to put in place of "/home/username/public_html/", since I am the designer for a client's site, and not the owner of the site itself.

    Should i put the "username" that i log into the ftp server with?

    The website is contained within the "public_html" directory, so I'm guessing I leave that as is...

Share This Page