Announcement

Collapse
No announcement yet.

ScriptCase Variable that contains the directory that SC is being run from

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ScriptCase Variable that contains the directory that SC is being run from

    Is there is a way to find the ScriptCase Variable that contains the directory that SC is being run from? I could have sworn I've seen it but I can't find it now.

    Or maybe it's a php function???

    Thanks

  • #2
    Look into the $_SERVER variable. A quick view is var_dump($_SERVER)
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Check here:
      http://stackoverflow.com/questions/4...s-of-nice-urls

      Comment


      • #4
        __DIR__ should work as well
        http://php.net/manual/en/language.co...predefined.php

        Comment


        • #5
          Originally posted by Sean H. View Post
          Too much care with this. Take a look to this file example using the following structure.

          /project/foo.php
          /project/includes/bar.php


          bar.php content:

          PHP Code:
          <?php
          function currentPath();
              return 
          __DIR__;
          }
          foo.php content:

          PHP Code:
          <?php
          include "./includes/bar.php";

          $path currentPath();
          echo 
          $path;
          So.... in you execute foo.php file, the result will be project/includes/ instead of project/

          Comment


          • #6
            ... well currentPath() is in bar.php which is in project/includes so I can (kinda) see why that happened.

            Why not use "echo __DIR__;" directly in foo.php?

            Comment

            Working...
            X