there is a separate file data_loader.php and there is an html view.html, how to make the code from the first file run in the second?
3 answers
So, in case your html in the 'php' file
<div> Hello World <?=$text;?></div> <div> Hello world <?php echo $text; ?> </div> If you have files with the extension .html you need to make sure that these files support php . write it in .htaccess
AddType application/x-httpd-php .php .html - And you could not give a link to any resource? - N. Turshiev
- rssinclude.com/blog/… - L. Vadim
- All the gud only have a problem, as a result of the script, leaving rhombs with questions? How to fix this? - N. Turshiev
- Make sure your
utf-8file is L. Vadim - is the file with the .php extension supposed to be UTF-8? - N. Turshiev
|
<head></head> <body class="page_bg"> Hello, today is <?php echo date('l, F jS, Y'); ?>. </body> </html> |
With the condition that your file has a PHP (.php) extension, for example
<div> <?php /*Тут ваш PHP код */ ?> </div> If you need to connect a file, you should change the extension of your view.html to view.php and write in the place for insertion
<?php include('data_loader.php'); ?> |