How to format code blocks in DotNetNuke 6
Sep
26
Written by:
9/26/2011 12:21 PM
Well, this is blog about development. Right? So in my posts I need to write some code, so I started to google how to format code blocks in DNN 6. There is a good article about that and you can find it here: Formatting Code Blocks in DotNetNuke 6
Article is pretty straightforward:
You need to log to site as SuperAdmin and start HTML Editor Manager from the Host menu. Then you need to select Toolbar configuration tab. You will get displayed XML file with configuration of the Editor toolbar. In the sections you need to add following XML to get FormatCodeBlock toolbar available in the toolbar of the HTML Editor:
<tool name="FormatCodeBlock"/>
Here begins the Nightmare. I tried to start HTML Editor Manager and have displayed nice red rectangle with message inside: "Object reference not set to instance of object", or something like that. What to do now ? I am new to DNN. How to found reason of this error ? First what I tried is to change web.config section to allow remote users to see errors. That isn't helped. Same rectangle again. After some research I found that I can see all errors using Admin->Event Viewer. In error logs I found following error:
DotNetNuke.Services.Exceptions.ModuleLoadException: Unhandled Error Adding Module to ContentPane ---> System.UnauthorizedAccessException
Access to the path '...\html\Portals\0\Users\001' is denied.
Why is there access denied ? I remember then. I have installed DNN on GoDaddy servers. GoDaddy does not allow that DNN be installed at root. I followed some articles and moved DNN to root folder. Because GoDaddy doesn't allow to set permissions on the root folder and because all subfolders inherit permissions from the root, they all have only read permission enabled.
After I changed permissions to read/write on this folder HTML Editor Manager was finally started. Then I changed ToolbarConfiguraton and clicked Update. Loading animation was displayed and nothing happened for few minutes.
I realized that there again must be some problem with permissions. After some research (again) I found that location of toolbar configuration file is "/DesktopModules/Admin/RadEditorProvider/ToolsFile/ToolsFile.xml". After changing perrmissions to read/write on folder DesktopModules everything is working fine.
As you can see, now I can format some text as code blocks:
if (something_was_wrong)
{
//maybe you need to read documentation first
}
else
{
//code not reachable
}