Sunday 15 July 2012

php - Including external resources through a view that extends a layout -


I'm trying to learn Laravel using it for one site, but I'm having trouble doing some work is. / P>

I have a layout.blade.php file that holds all my global markup. Content like header, footer etc. I would like some external stuff like stylesheets and scripts like & lt; Head & gt; like:

  {{HTML :: script ('js / bootstrap.min.js'); }}   

However, there are some external things that just want to load on some pages. I am including personalized scenes from the title like this:

  & lt; Div id = "content" & gt; @shield ('content') & lt; / Div & gt;   

In more views, I am expanding the layout like this:

  @extends ('layout') @section ('content') & Lt; H1 & gt; Some content & lt; / H1> @stop   

I use my & lt; Head & gt; How do I use the HTML :: script type function to include content from a scene in ? layout.bad.fp ?

Thank you!

In your layout.blade.fp , your HTML: : Call script in section () and @. Show the tag, and just expand it later in your child's view, as you did with the section, but using @parent to include the contents of the parent Also do the example:

Layout.blade.fp

  @section ('javascript') {{HTML :: script ('js / Jquery js')}} {{HTML :: script ('js / bootstrap.min.js')}} @ show   

childview.blade.php

  @extends ('layout') // ... @section ('javascript') @parent {{HTML :: script ('js / customScript.js')}} @stop    

No comments:

Post a Comment