Member Offer
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XML/PHP Question

Discussion in 'Website Design Forum:' started by iEthan, Mar 21, 2009.

  1. iEthan

    iEthan Member

    So, I'm creating a XML-based PHP content management system. Here is the basic hierarchy of the directory.

    LiteManage/
    pgs/
    index.xml
    .htaccess
    display.php
    ...
    index.php

    So, I want to create a script that will get the index.php and match it with a XML file in pgs/ (which would be index.xml). I know how to display the contents with SimpleXML, but I can't figure out how to get the url. I know you use $_GET, but what format?

    Thanks,
    ~Ethan
     
  2. darren

    darren Member

    Hi,

    The $_GET array is for variables passed via the url such as index.php?variable_name1=value&variable_name2=value2.

    and you get these like so;

    PHP:
    $myvar $_GET['variable_name1'];
    $myvar woudl now equal "value";

    To get the current URL/URI you use the $_SERVER array;

    PHP:
    $_SERVER['REQUEST_URI']
    or you could use

    PHP:
    $_SERVER['PHP_SELF']
    PHP: $_SERVER - Manual
     
  3. Jazajay

    Jazajay Active Member

    So let me get this right, you want to 1 find the current page, and 2 then look for an equivalent file in the pg directory?

    Or d you just want to get the index.xml file from the pg directory if the index.php file is accessed?
     

Share This Page