html - How to display Orchard shape only once? -
i have common shape renders html code display error dialog.
the html code needs included once throughout whole web site. scripts , styles orchard provides script.include()
, style.include()
methods.
i wonder whether there similar html code, ideas?
so many options this
- can add code layout.cshtml in theme
- create new widget , attach shape field create on default layer (so on pages) name of shape in shape field
- add shape in filter, or anywhere else have access workcontext :)
code written memory, may not compile
using system.linq; using system.web.mvc; using orchard; using orchard.displaymanagement; using orchard.mvc.filters; using orchard.ui.admin; public class myfilter : filterprovider, iresultprovider { private readonly dynamic _shapefactory; private readonly workcontext _workcontext; public myfilter(workcontext workcontext, ishapefactory shapefactory) { _workcontext = workcontext; _shapefactory = shapefactory; } public void onresultexecuting(resultexecutingcontext filtercontext) { // should run on full view rendering result if (!(filtercontext.result viewresult)) return; // front end if (adminfilter.isapplied(new requestcontext(_workcontext.httpcontext, new routedata()))) return; var body = _workcontext.layout.body; body.add(_shapefactory.myshape()); } public void onresultexecuted(resultexecutedcontext filtercontext) {} }
Comments
Post a Comment