Using Umbraco 6.1.3 and am having an odd issue with InitializePage as a function within a Razor script, but ONLY if the call is within the Header or Footer. Lemme explain...
protected override void InitializePage() { test = true; }
}
If I put that stripped down code in either the SiteHeader or the SiteFooter script those sections don't render at all with the on-screen error of "Erorr Loading MacroEngine script (file: <whichever script>)". Putting in an empty InitializePage function has the same result (eg - just the existance of the function call is making it pissy).
All of the pages on the site are subs for the Master and render macros from within the MainContent placeholder and a few of these pages have an InitializePage function and render without issue. I've tried the stripped down one in just about every other page and am not having problems...only if I put it in the SiteHeader or SiteFooter scrips.
All of the templates (all subs of the Master) look like this (obviously calling different macros):
At first I thought is may puking about multiple InitializePage calls,
but the issue still comes up if the page rendered within MainContent does not have that
function call.
I've tried commenting out the JS file(s) thinking that there may be some conflict there, but that does not appear to be the issue either. I've also tried moving the Footer macro call out of the Master and into a sub tempate that leverages the MainContent placeholder with no change. I've also tried changing the Header/Footer tags to sections/divs without any change in the behavior.
I've done this same thing (InitializePage) in other sites running under 4.7.x with no issue.
I've been in this rabbit hole for a few hours now and am totally at a loss.
Any ideas?
Thanks in advance,
Rick
PS - Wanting to add this to the Header so I can display a Log Out button if they are logged in...again, something that I've done under other 4.7.x sites, but never under a 6.x site.
Apparently, if you have ANY @Html.Raw calls in your helpers, you cannot use InitializePage. If you need the Html.Raw calls in your helpers, using RenderPage to another cshtml script with the function also resolves this issue.
If anyone has any insight as to why this happens, I would be interested in hearing it.
Issue with InitializePage in header/footer
Hey all,
Using Umbraco 6.1.3 and am having an odd issue with InitializePage as a function within a Razor script, but ONLY if the call is within the Header or Footer. Lemme explain...
MasterPage Template Core:
Stripped Down InitializePage Function:
If I put that stripped down code in either the SiteHeader or the SiteFooter script those sections don't render at all with the on-screen error of "Erorr Loading MacroEngine script (file: <whichever script>)". Putting in an empty InitializePage function has the same result (eg - just the existance of the function call is making it pissy).
All of the pages on the site are subs for the Master and render macros from within the MainContent placeholder and a few of these pages have an InitializePage function and render without issue. I've tried the stripped down one in just about every other page and am not having problems...only if I put it in the SiteHeader or SiteFooter scrips.
All of the templates (all subs of the Master) look like this (obviously calling different macros):
At first I thought is may puking about multiple InitializePage calls, but the issue still comes up if the page rendered within MainContent does not have that function call.
I've tried commenting out the JS file(s) thinking that there may be some conflict there, but that does not appear to be the issue either. I've also tried moving the Footer macro call out of the Master and into a sub tempate that leverages the MainContent placeholder with no change. I've also tried changing the Header/Footer tags to sections/divs without any change in the behavior.
I've done this same thing (InitializePage) in other sites running under 4.7.x with no issue.
I've been in this rabbit hole for a few hours now and am totally at a loss.
Any ideas?
Thanks in advance,
Rick
PS - Wanting to add this to the Header so I can display a Log Out button if they are logged in...again, something that I've done under other 4.7.x sites, but never under a 6.x site.
Appears to be resolved...
Apparently, if you have ANY @Html.Raw calls in your helpers, you cannot use InitializePage. If you need the Html.Raw calls in your helpers, using RenderPage to another cshtml script with the function also resolves this issue.
If anyone has any insight as to why this happens, I would be interested in hearing it.
Thanks,
Rick
is working on a reply...