CodeIgniter Forums
how to mix html and php? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: how to mix html and php? (/showthread.php?tid=81170)

Pages: 1 2


RE: how to mix html and php? - Kerry Watson - 02-04-2022

PHP is an embedded language, you can switch between plain HTML code and PHP code without losing readability. PHP code must be separated from HTML using PHP start and end tags in order to be embedded. The PHP tags indicate where the PHP code begins and finishes for the web server.


RE: how to mix html and php? - richb201 - 02-04-2022

I replaced that but it is still not working.


RE: how to mix html and php? - John_Betong - 02-04-2022

@richb201 ,
> Thanks. It seems phpStorm doesn't like <?php endif ?> So I tried

Code:
<php if ($this->dataStore("cost_center")->get(0,"num_projects")>0 ;?>

I think the syntax has an incorrect semi-colon instead of a period when trying to use PHP alternative syntax:

https://www.php.net/manual/en/control-structures.alternative-syntax.php


RE: how to mix html and php? - InsiteFX - 02-05-2022

He's also missing the if statements right )


RE: how to mix html and php? - John_Betong - 02-05-2022

(02-05-2022, 03:08 AM)InsiteFX Wrote: He's also missing the if statements right )

Perhaps he should try setting the following because errors would be thrown which would have to be cleared before trying to run the script. Why wait, best to know immediately there are problems:

Code:
<?php declare (strict_types=1);
error_reporting(-1);
ini_set(‘display_errors’, ‘true’);