SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Mar 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    new and need help pls

    Hi,

    I am new to PHP and new to this board. I am attempting to produce a web page (standalone for now) in PHP. We are using PHP 4.33, an Oracle 10g database on an Apache web server with a Linux 3.0AS operating system.

    All the include files run through an index.php file. An action is being set and depending on the action an include file is called. In the index.php file, I believe the developer is checking to see what the action is and then setting a variable called nextLoc. He is doing this with the code below:

    if (isset($_GET) && ($_GET["a"] != "")) {

    $nextLoc = $_GET["a"];

    } else if (isset($a) && ($a != "")) {

    $nextLoc = $a;

    } else {

    // Default Location.
    $nextLoc = "Main";

    }

    Later in the code he is concatenating the variable nextLoc with the file name structure and thereby calling the page with this code. All include files have the same naming convetion  kkc_srp_somename.inc.

    include_once($incDir."kkc_srp_".$nextLoc.".inc");

    What I canít figure out is where he is setting the actions and associating an action with a file name. If you look at the actions given and then the file names, they donít always coincide exactly. For example, the action ďprofile_entryĒ seems to call kkc_srp_Profile.inc. How can I figure out where these are being set? I canít reach the programmer who wrote this and I am stuck.

    For now the page is supposed to be called as a standalone. Later it will be called from the menu on the homepage.

    Any insight is greatly appreciated.

    TIA,
    New_developer

  2. #2
    SitePoint Member hacki's Avatar
    Join Date
    Feb 2006
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You may use this:
    Code:
    $files_arr = Array(
    'profile_entry' => 'Profile',
    'some_page' => 'Page1'
    ...
    );
    
    include_once($incDir . "kkc_srp_".$files_arr[$nextLoc].".inc");

  3. #3
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I canít figure out is where he is setting the actions and associating an action with a file name.
    "actions" ??

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i assume you mean action as in the variable named 'a' that is passed through the url? eg
    index.php?a=profile_entry

    from the code you provided, its not possible for profile_entry to result in kkc_srp_Profile.inc it would result in kkc_srp_profile_entry.inc


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •