SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    a fresh, new start... dujmovicv's Avatar
    Join Date
    Aug 2006
    Location
    Earth
    Posts
    559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    include some.php AND whatever.js ??

    Please look at the
    Code:
    <?php 
    $lang = $_GET["language"];
    $_SESSION['saved_lang'] = $lang;
    if ($lang == "")
    {
    	$lang = 1;
    }
    include ('banner1.php');
    include ($lang.js);
    ?>
    My browser returns the following:

    Warning: Failed opening 'VALUE_OF_LANGjs' for inclusion (include_path='.;c:\apache\php\pear') in c:\apache\htdocs\jsmenu\index.php on line 16

    I'm really confused with that... Is there an error in my .conf file, or it is NOT possible to include JS file into php?
    Every help will be appreciated...

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is a PHP question, so it's in the wrong forum, but the solution is simple. The argument for the include statement must be a string:
    PHP Code:
    include $lang '.js'
    Birnam wood is come to Dunsinane


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
  •