Switching the Layout in Orchard CMS

Topics: Writing themes
May 29, 2011 at 2:37 AM

Following the instructions on the blog post http://weblogs.asp.net/bleroy/archive/2010/12/14/switching-the-layout-in-orchard-cms.aspx?CommentPosted=true#commentmessage

After following the instructions and adding the class to the Filter folder I cannot get the code to hit a breakpoint leading me to believe it is not working.  Is there a dependency or other code I need for it to be hit?

Thanks

May 29, 2011 at 12:35 PM

Dependencies should automatically get loaded - a common reason for code not getting hit is if you haven't saved the project, so Orchard doesn't know the file is there. Try "Save All" or "Build".

May 29, 2011 at 1:02 PM

Check that! Project is very saved and very built (err rebuilt, and rebuilt...)

May 29, 2011 at 1:53 PM

So either;

- Module or feature isn't enabled

- Code is running but for some other reason isn't working

Can you post your code so I can check it?

May 29, 2011 at 2:00 PM

Great!  Thanks for the help.  I am not really sure what portion of the code you want or how to post it.  You don't want the entire solution do you?

May 29, 2011 at 2:13 PM

I found the reason.

When I first created my theme i did not use the codegen theme command line utility. Instead I just copied the ThemeMachine folder and edited the results.  So even though I was able to install my theme and see it work visual studio would not recognize it for some reason.

Anyway, I used the command line tool and copied all my files there including the filter and it does indeed stop at the breakpoint.  

 

I think all is well now so I should be able to create alternate layouts now... i hope! ;)

 

thanks again for the help

Coordinator
May 29, 2011 at 6:39 PM

Some reason is that you had a code-less theme. There needs to be a csproj in the theme.

Jul 7, 2011 at 7:09 AM
Edited Jul 7, 2011 at 7:28 AM

Be sure that not installed CustomLayoutMachine theme from artical in your first message. If CustomLayoutMachine theme installed and disabled, code continue working. You should try to delete this theme and check how works your theme without it.