I am using PHP and CodeIgniter. In every view file, I include the header.php, seen below:
<head>
<link rel="...">
<script type="text/javascript">...</script>
</head>
Notice that the head tag is closed in this file. Now I want to add a <script> tag in another file without modifying header.php. C# has ContentPlaceHolder that can be used to indicate where tags can be added within head tag. Is there any equivalent in php? If not, How can I achieve this?
You can easily add other scripts in your header by adding a single variable in your controller like this:
Controller:
Then in your header.php add:
This makes a very customizeable template for each view because you can add the scripts only in the views you need them.