Editing
Web Template
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Partial Templates=== Sometimes it is useful to write a ''partial template'', that is, one that only represents part of a web page and is used elsewhere, e.g. a header which is used site-wide. This is possible. First, create a web template with the Visible property unchecked. Leave the DataModel blank, since that is only useful when loading the page from an HTTP request. For this example, give it the Slug ''header'', and set its content to be:<pre> <header> <h1>The Title</h1> </header> </pre>Then, within the main page, call <code>@Raw(WebHandler.RunTemplate(WebDatabaseInterface.GetWebTemplateBySlug("header"), Model))</code> Through this, the header will be inserted into the main page. Note that @Raw is required, for otherwise the retrieved HTML will be displayed as plain text, rather than interpreted as HTML. This method can also be used for loading stylesheets which must load styling information non-statically. Simply save the stylesheet as a WebTemplate instead of as a WebStyle, and the load it as a template.
Summary:
Please note that all contributions to PRS may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
PRS:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Refresh
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information