1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP Include

Discussion in 'PHP' started by honey, Apr 10, 2005.

  1. #1
    I have 30 text files in a folder. Each of them contains appointments / events for the said date, much like a calendar.

    Now, what I am trying to do is, call this data into a CRM application.

    I have a little function that checks the date for today, since today is 10th, it will give me the number 10.

    So when I say, echo $today; and see the page in the browser it says 10.inc.
    Now, I want to include 10.inc on this page.

    How can I do that ? If I try to do

    <?
    include ('<?php require $today; ?>');
    ?>

    and then display this in the browser, it says <? echo ('10.inc'); ?> instead of actually displaying the contents of the file. I know the problem and understand what is happening. I am sure I explained what I am trying to do. Can anyone help ?
     
    honey, Apr 10, 2005 IP
  2. nullbit

    nullbit Peon

    Messages:
    489
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can't you just replace all that with:

    
    include $today;
    
    PHP:
    I think you need to give more context otherwise.
     
    nullbit, Apr 10, 2005 IP
  3. GTech

    GTech Rob Jones for President!

    Messages:
    15,836
    Likes Received:
    571
    Best Answers:
    0
    Trophy Points:
    0
    #3
    <? include($today) ?>

    Should do the trick.

    You may also need to add a text handler to your .htaccess to identify .inc files:

    AddType text/html .inc
    AddHandler server-parsed .inc
     
    GTech, Apr 10, 2005 IP
  4. honey

    honey Prominent Member

    Messages:
    15,555
    Likes Received:
    712
    Best Answers:
    0
    Trophy Points:
    325
    #4
    Thanks a TON Gtech, it worked. I owe you a Lunch. nullbit, you too.
     
    honey, Apr 10, 2005 IP
  5. rajeev_seo

    rajeev_seo Peon

    Messages:
    211
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    you use this
    <?php include($today); ?>
     
    rajeev_seo, Apr 24, 2011 IP