Activity Stream
48,167 MEMBERS
6800 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 6 of 6
  1.     
    #1
    Member
    Website's:
    xwn2.com imagedy.com xwn2.info

    Default simple variable php question

    im trying to call for a variable for part of a link

    include ('$themedir; /index.php');

    this is not working

    the variable is $themedir = '/theme/default';

    and is located in a diffent .php that had been included before
    zebono2 Reviewed by zebono2 on . simple variable php question im trying to call for a variable for part of a link include ('$themedir; /index.php'); this is not working the variable is $themedir = '/theme/default'; and is located in a diffent .php that had been included before Rating: 5


  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    wiixps.com
    1. can't call variable inside include
    2. for your work, I suggest you do

    if (index){
    $themedir = '/theme/default';
    }else{
    $themedir = ' '/theme/default2';
    }

    load $themedir


    hope this will help you guy

  4.     
    #3
    Respected Member
    Website's:
    DL4Everything.com Soft2050.in
    Quote Originally Posted by hugo04 View Post
    1. can't call variable inside include
    Wrong, you can use variables inside a include statement

    ----------------------------
    PHP Code: 
    include ('$themedir; /index.php'); 
    Why is there a ; in the code and to use variables you need to use double quotes (")

    PHP Code: 
    include ("$themedir/index.php"); 
    Also, the themedir variable:
    PHP Code: 
    $themedir '/theme/default'
    Whats the path from the script you are using?
    use realpath() to check whether you are on the right directory or not

    http://php.net/manual/en/function.realpath.php

  5.     
    #4
    Member
    Website's:
    tehMoviez.com 0Senes.com GeekFaceGames.com
    soft2050 is right. just another note, if you get problems about the path, use
    PHP Code: 
    include (getcwd() . "/$themedir/index.php"); 

  6.     
    #5
    Member
    Website's:
    xwn2.com imagedy.com xwn2.info
    thanks guys i got it working by using

    include ("$themedir/index.php");


  7.     
    #6
    Member
    Website's:
    epicimagehost.com
    I'm actually not a big fan of double quotes.

    Personally I tend to always use single quotes when possible.
    Here you have both methods:

    PHP Code: 
    <?php
    include($themedir '/index.php'); // Notice the dot
    ?>

    <?php
    include("$themedir/index.php");
    ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. A simple question
    By lordofupload in forum File Host Discussion
    Replies: 6
    Last Post: 29th Nov 2011, 04:15 AM
  2. A Simple Question
    By lordofupload in forum Web Development Area
    Replies: 3
    Last Post: 29th Nov 2011, 12:44 AM
  3. Simple Question ?
    By CrOwN. in forum File Host Discussion
    Replies: 6
    Last Post: 9th Nov 2011, 11:52 PM
  4. [Hiring] Need someone to answer a simple php question.
    By daxzor in forum Completed Transactions
    Replies: 5
    Last Post: 14th Jul 2011, 01:52 AM
  5. Simple VB question
    By KaiTrac in forum Technical Help Desk Support
    Replies: 1
    Last Post: 1st Dec 2008, 04:26 PM

Tags for this Thread

BE SOCIAL