This project has moved. For the latest updates, please go here.

Issues with Theme Variables ($macros.Variables)

Coordinator
Apr 20, 2010 at 1:30 AM

Has anyone else had any issues using theme variables? I am having a strange issue were everything seems to work the first time through, but shortly after on page refreshes I start getting the following errors when trying to render the variables in the theme.

 


The view footer.view could not be rendered

NVelocity.Exception.MethodInvocationException: Invocation of method 'Variable' in Graffiti.Core.Macros threw exception System.Exception : Type Graffiti.Core.ThemeConfigurationData could not be found or created ---> System.Exception: Type Graffiti.Core.ThemeConfigurationData could not be found or created at Graffiti.Core.ObjectManager.Get[T](String name) in C:\Users\jeremyh\Desktop\Latest G\Branches\v1.3\src\Graffiti.Core\Util\ObjectManager.cs:line 48 at Graffiti.Core.GraffitiContext.get_ThemeConfiguration() in C:\Users\jeremyh\Desktop\Latest G\Branches\v1.3\src\Graffiti.Core\UI\GraffitiContext.cs:line 159 at Graffiti.Core.Macros.Variable(String id) in C:\Users\jeremyh\Desktop\Latest G\Branches\v1.3\src\Graffiti.Core\UI\Macros.cs:line 207 --- End of inner exception stack trace --- at NVelocity.Runtime.Parser.Node.ASTMethod.Execute(Object o, IInternalContextAdapter context) at NVelocity.Runtime.Parser.Node.ASTReference.Execute(Object o, IInternalContextAdapter context) at NVelocity.Runtime.Parser.Node.ASTReference.Value(IInternalContextAdapter context) at NVelocity.Runtime.Parser.Node.ASTNENode.Evaluate(IInternalContextAdapter context) at NVelocity.Runtime.Parser.Node.ASTExpression.Evaluate(IInternalContextAdapter context) at NVelocity.Runtime.Parser.Node.ASTIfStatement.Render(IInternalContextAdapter context, TextWriter writer) at NVelocity.Runtime.Parser.Node.SimpleNode.Render(IInternalContextAdapter context, TextWriter writer) at NVelocity.App.VelocityEngine.Evaluate(IContext context, TextWriter writer, String logTag, TextReader reader) at NVelocity.App.VelocityEngine.Evaluate(IContext context, TextWriter writer, String logTag, String inString) at Graffiti.Core.TemplateEngine.Evaluate(TextWriter tw, String templatedata, IContext iContext) in C:\Users\jeremyh\Desktop\Latest G\Branches\v1.3\src\Graffiti.Core\UI\TemplateEngine.cs:line 54 at Graffiti.Core.TemplateEngine.Evaluate(String templatedata, IContext iContext) in C:\Users\jeremyh\Desktop\Latest G\Branches\v1.3\src\Graffiti.Core\UI\TemplateEngine.cs:line 46 at Graffiti.Core.ViewManager.RenderTemplate(HttpContext httpContext, GraffitiContext graffitiContext, String theme, String file) in C:\Users\jeremyh\Desktop\Latest G\Branches\v1.3\src\Graffiti.Core\UI\ViewManager.cs:line 78

Coordinator
Apr 20, 2010 at 3:21 AM

Want to share the theme? Ill try it out, maybe with the debugger running too if i get the error.

Coordinator
Apr 20, 2010 at 3:32 AM
jkillebrew wrote:

Want to share the theme? Ill try it out, maybe with the debugger running too if i get the error.

Sure, what is the best way to get it to you?

Coordinator
Apr 20, 2010 at 2:43 PM
Edited Apr 20, 2010 at 9:57 PM

I'm seeing the problem as well. I havent spent much time on it but at first glance it looks like the theme config is stored in the database and once it expires from the cache, it cannot be ready from the db again because the type it is stored as, Graffiti.Core.ThemeConfigurationData, is a type which is not found but the object manager and thats where it blows up. I'll dig a little deeper when I've got some time.

Coordinator
Apr 20, 2010 at 3:54 PM

Three of the theme variables have a space in the id, which in turn causes improper xml in the database that cannot be deserialized in the process of caching data from the database, however immediately after you save your theme settings, the data in the cache is still being used so thats why the problem doesnt appear right away (i think). Here is an example for what the stored theme settings look like  in the db:

<?xml version="1.0" encoding="utf-16"?>
<ThemeConfigurationData Theme="Cheatham Lab" HomepageHeadline="HomePage Headline" HomepageText="Homepage Text" Twitter URL="tweetaccount" Facebook URL="test" LinkedIn URL="test" />

The Facebook, Twitter, and LinkedIn Urls have spaces. By removing the spaces from their property id's in the theme.config file, the problem went away for me.

Here is a great example of what you can do with theme variables http://arcware.net/this-is-the-greatest-graffiti-theme-in-the-world-hellip-rounded/

I dont think there is any documentation for this but we should create some.

Coordinator
Apr 21, 2010 at 12:53 AM

Okay, I removed the spaces and then after renaming the theme it worked. Thanks!

Coordinator
Apr 21, 2010 at 4:56 AM

Good deal. Sorry I forgot to mention you would have to delete that row from the database or using a new name for the theme works too. It seems graffiti should check your theme config file and refuse to save if any of the attributes contain spaces. Something for the future.