Search code examples
phpechofile-get-contents

PHP statement within echo


I am essentially trying to combine to PHP statements.

<?php echo ROOT_PATH; ?>
<?php echo file_get_contents( "../css/themes/subtitle.php"); ?>

I want to achieve something like this:

<?php echo file_get_contents( "ROOT_PATH/css/themes/subtitle.php"); ?> 

Solution

  • Its pretty simple you can change it to following

    //full path of the file 
    $file_name = ROOT_PATH."/css/themes/subtitle.php";
    echo file_get_contents($file_name);
    

    it should work