Echo statement in an include

3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 7, 2012   (RSS)

By loccom - January 7, 2012

I am pretty newish to php, basics i don;t have a problem with, but i seem to be stuck on something thats probably really easy.

I am looking to echo a word from CMSB into an include.

ie <? include("blah.inc.php"); ?>

The file name "blah" i wish to echo an entry from the database but I am unable to echo this into the include.

Below will obviosuly wont work, but how can i make an entry automatically enter the right word in to my include?

<? include("<?php echo $blahRecord['blah_word'].inc.php?>"); ?>

Re: [loccom] Echo statement in an include

By Dave - January 7, 2012

Hi loccom,

Try this:

<?php include( $blahRecord['blah_word'] . ".inc.php" ); ?>

Let me know if that works for you.
Dave Edis - Senior Developer

interactivetools.com