SparkViewEngine: Is there a functionality available that's equivalent to a PHP Include?
I am using the SparkViewEngine with ASP.NET MVC 1.0 and was wondering开发者_运维问答 if there is a way to include another View within your current view.
For example, I have this view called ResourceManager.spark. Inside this file, I want to include another sub-view called Resources.spark.
Thanks! Abe
Yes you can using a partial file. The syntax is
<use file="Resources" />
it will then look for a file called Resources.spark in the View/<ControllerName
> directory and if that isn't found in the shared directory.
If you name the file _Resources.spark then you could also use it as a custom element (sans the underscore) like so
<resources />
for more information see http://sparkviewengine.com/documentation/organizingcontent#Parsingandrenderingpartialfiles
Sure, you can use named content areas.
Take a look at the documentation on the Spark website
There is also a good video tutorial at DimeCasts.Net
精彩评论