Forums

PHP include variable file problem, Im confused! (3 posts)

  1. knight42
    Member
    Posted 2 years ago #

    Hi All
    Am trying to include a template file in my theme, but the file name is a variable set at the back end (this works I can get the file name to echo properly)

    Im having problems getting the file to include in the index page. So far I have this:

    <?php include bloginfo('template_directory'); ?>/thatfolder/<?php echo $test_test;?>`

    with $test_test as the file name im after. Rather than pulling in the contents of the file it just echos the location, so I get:

    http://localhost:8888/wptestsitedata/wp-content/themes/mytheme/thatfolder/FILENAME.php

    With the variable FILENAME being correctly echoed.

    I really want to include the contents of this file, but cant seem to make a simple include work with a variable.

    Can anyone help?? Thanks if you can!!!

  2. esmi
    Theme Diva & Mod
    Posted 2 years ago #

    <?php include (TEMPLATEPATH.'/'.$test_test);?>

  3. knight42
    Member
    Posted 2 years ago #

    Thank you Esmi! That works perfectly! Thank you again!!!!

Topic Closed

This topic has been closed to new replies.

About this Topic