I was trying to use file_get_contents to load a phtml file and store in variable, but it seems that the php blocks are ignored
<?php include_once '../php_inc/core.inc.php'; ?>
<div class="dialog-header">
<div class="dialog-header-inner">
<div class="inline-blk left-align dialog-header-left-item"><div class="bar-title vertical-center">Guitar</div></div>
<div class="inline-blk right-align dialog-header-right-item pointer">
<div class="bar-title dialog-header-bar-option inline-blk"><div class="vertical-center" >Post</div></div>
<div class="bar-title dialog-header-bar-option inline-blk"><div class="vertical-center" ><img src="<?php echo IMGDIR ?>menu_navi_icon.png" width="20" height="13"></div></div>
</div>
</div>
</div>
When I do something like echo file_get_contents(myfile.phtml), when I inspect the element in the chrome, it automatically comment my php block
<!--?php include_once '../php_inc/core.inc.php'; ?-->
<div class="dialog-header">
<div class="dialog-header-inner">
<div class="inline-blk left-align dialog-header-left-item"><div class="bar-title vertical-center">Guitar</div></div>
<div class="inline-blk right-align dialog-header-right-item pointer">
<div class="bar-title dialog-header-bar-option inline-blk"><div class="vertical-center">Post</div></div>
<div class="bar-title dialog-header-bar-option inline-blk"><div class="vertical-center"><img src="<?php echo IMGDIR ?>menu_navi_icon.png" width="20" height="13"></div></div>
</div>
</div>
</div>
and the IMGDIR constant didn't get echoed as well.I know I need to use either GET OR POST to pass custom data. However, I just need to basic set up in the core.inc.php like some constant variables,etc.
.phpfile that is why PHP code is not being executedphtmlextension to distinct that the file contains more html codes while with a few lines php codes embedded, but it seems thefile_get_contentstreat it in a different way