I have this issue. I have HTML code stored in the database. I read it, and I display it in my pages using echo $page_content;
I want to add somewhere in the middle of this HTML code a php include. Something like this: Inside this file I have also html code which is basically the country options for a select:
<option selected="selected" value="">Choose...</option>
<option value="AFGHANISTAN">AFGHANISTAN</option>
<option value="ALBANIA">ALBANIA</option>
<option value="ALGERIA">ALGERIA</option>
<option value="AMERICAN SAMOA">AMERICAN SAMOA</option>
<option value="ANDORRA">ANDORRA</option>
<option value="ANGOLA">ANGOLA</option>
etc etc
Until now I have hard-coded all the countries in many places, which I don't like.
But this is not displayed at all when i do my echo $page_content;
includestatement. For example you could define the root of your application usingdefine( 'DIR_ROOT', dirname( __FILE__ ) );in a file in the highest directory of your site, for example aconfig.phpfile (which has to be included/required by all other pages). Then you use this in your include calls. As such:include( DIR_ROOT . DIRECTORY_SEPARATOR . 'countries.php' );