I'm using ASP.NET MVC3 at work, while using PHP at home. I wish to use the Sections feature of MVC3 in CodeIgniter, does it have such feature?
Example in ASP.NET MVC3 (not tested):
<!-- A view, that serves the content -->
@section Head{
<script src="myscript.js"></script>
}
<p>This is my main content -
I require myscript.js to be included on my page,
so I specify a head section, which the header of my page will render</p>
<!-- ANOTHER view, that serves the content -->
@section Head{
<script src="otherscript.js"></script>
<link rel="stylesheet" type="text/css" href="somestyle.css" />
}
<p>Some OTHER view, with OTHER dependencies!</p>
<!-- Header File, where I include CSS and JS! -->
<head>
<script src="jquery.js"></script>
@Html.Section("Head")
</head>
The point is, for example, in a specific view, I wish to include a script file, so I add the <script>
to the section, and that section is rendered in the header (which is in a different view)