Title: PHP include variable file problem, Im confused!
Last modified: August 19, 2016

---

# PHP include variable file problem, Im confused!

 *  [knight42](https://wordpress.org/support/users/knight42/)
 * (@knight42)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/php-include-variable-file-problem-im-confused/)
 * 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](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!!!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/php-include-variable-file-problem-im-confused/#post-1143180)
 * `<?php include (TEMPLATEPATH.'/'.$test_test);?>`
 *  Thread Starter [knight42](https://wordpress.org/support/users/knight42/)
 * (@knight42)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/php-include-variable-file-problem-im-confused/#post-1143184)
 * Thank you Esmi! That works perfectly! Thank you again!!!!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP include variable file problem, Im confused!’ is closed to new replies.

## Tags

 * [call](https://wordpress.org/support/topic-tag/call/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [variable](https://wordpress.org/support/topic-tag/variable/)

 * 2 replies
 * 2 participants
 * Last reply from: [knight42](https://wordpress.org/support/users/knight42/)
 * Last activity: [16 years, 11 months ago](https://wordpress.org/support/topic/php-include-variable-file-problem-im-confused/#post-1143184)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
