Could you tell us what version of Umbraco you're using and if it's an upgrade from an older version (and if it is an upgrade, did you add the extra keys to web.config and umbracosettings.config)?
As Toni says, you might want to check if the property exists, but you don't need the inherits.
Happens to me to. Seems to be something with <style> and inline macro scripts. http://umbraco.codeplex.com/workitem/30225 other tags I tested works fine (<p> for example>
Workaround : move the script to a macro instead and add the macro to your template.
Hmm, I get the same error when I try to include a <script> tag inside the Macro. Not sure why, but you can always do something like this to get around it.
Hy alex hope you've spent a nice weekend, could you look at my topic please and see if you have some kind of solution or maybe a way to solve this problem.
Problem with simple inline razor
All I want to do is this inline razor:
<umbraco:Macro runat="server" language="cshtml">
@if(Model.noSidebar)
{
<style>
//SOME CSS
</style>
}
</umbraco:Macro>
What am I doing wrong?
> What am I doing wrong?
Could you let us know what the problem is? It's a little hard to tell from your post which makes it difficult to help :)
The legend, himself!
Right, sorry about not including the error. I was thinking my syntax was way off or something, but I guess not.
Try this out our use your code but you should add the @inherits to make it work your razor code.
Test it and than give me an answer.
<umbraco:Macro runat="server" language="cshtml">
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
if (Model.HasProperty("noSidebar")) {
@foreach (var sideBar in @Model.Children) {
<style type="text/css">
YOUR CSS
</style>
}
}
}
</umbraco:Macro>
Could you tell us what version of Umbraco you're using and if it's an upgrade from an older version (and if it is an upgrade, did you add the extra keys to web.config and umbracosettings.config)?
As Toni says, you might want to check if the property exists, but you don't need the inherits.
Also, make sure that the casing of the property name of "NoSidebar" is correct (except for the first letter, it can be either upper or lower case.
Good morning Sebastiaan :) hope you've spent a nice weekend. And here it comes :)
Can you have a look at my former post "Coding Logic..." please.
I need some help for a customer project :) Thanks a lot
I'm using a fresh install of 4.7
The casing in the razor matches the alias on the document type.
All of this is happening on my development machine with WebMatrix.
Happens to me to. Seems to be something with <style> and inline macro scripts. http://umbraco.codeplex.com/workitem/30225 other tags I tested works fine (<p> for example>
Workaround : move the script to a macro instead and add the macro to your template.
Hmm, I get the same error when I try to include a <script> tag inside the Macro. Not sure why, but you can always do something like this to get around it.
Hy alex hope you've spent a nice weekend, could you look at my topic please and see if you have some kind of solution or maybe a way to solve this problem.
Here comes the link. http://our.umbraco.org/forum/developers/razor/19068-Coding-Logic-for-Razor-DynamicNode-and-Properties-ideas-needed
Thanks for everything
is working on a reply...