Input .html File Without using php

Discussion in 'HTML & Website Design' started by geekazoid, Jul 7, 2006.

  1. #1
    Because the process im using is a php one i need to be able to input a .html file in a php file without using

    php aquire or php include

    is this possible

    i need something like

    Input:>"<?php echo $filenames[$num]; ?>"

    The <?php echo $filenames[$num]; ?> bit is the bit thats confilicting with the php include bit

    For example ....

    <?php include("<?php echo $filenames[$num]; ?>"); ?></td>

    The script above is what i need to work but because there is a php in a php it wont work ? Is there anyway around this ?????
     
    geekazoid, Jul 7, 2006 IP
  2. the_pm

    the_pm Peon

    Messages:
    332
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'm not a PHP guru by any stretch of the imagination, but doesn't echo basically print a statement onto the screen? If you're trying to dynamically generate a page name from an array, set a variable equal to $filenames[$num] and then use a simple include statement to call it -

    <?php
    $foo = $filenames[$num];
    include $foo;
    ?>

    That might be wrong syntax (again, I've never written a line of PHP in my life), but the gist of it should be correct.
     
    the_pm, Jul 7, 2006 IP
  3. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #3
    What PM said. You can't nest PHP inside PHP. Yuo are opening php <?php and then opening it again <?php. Not an option. Just do:

    
    <?php include($filenames[$num]); ?>
    
    PHP:
     
    T0PS3O, Jul 7, 2006 IP
  4. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Cuh Brilliant Thanx Guys. Its working Now !
     
    geekazoid, Jul 7, 2006 IP