Creating Add-ons

May 24, 2012 at 4:26 PM

First of all, thanks for this product, it is awesome. I am using it for my professional web site:

I made a small blog engine that is made out of a widget and a small code added to the Default page. How can I pack this as an add-on and donate it to the community?

May 24, 2012 at 7:40 PM

1) I'm happy to hear that you like it. You can post review here :

2) I didn't have time to make a video showing how to create add-ons (hope to have one soon). For now you can download free add-on(contact form) and it should give you some idea how it is done).

If you can zip the demo site with the blog and send it to me (info [at] , maybe i will be able to help. I think that people would love to have some kind of blog.

May 29, 2012 at 12:35 PM

I am also working on a shopping cart, so I took a different approach.

First, I added a pBodyPage(nvarchar,50) column to the rc_Pages table, and I added all the modifications to maintain it on the admin side.

in the NewPage.cshtml:

                //copy existing page
                var copyPage = "INSERT INTO rc_Pages " +
                             "(pName, pTitle, pText, mTitle, mDescription, mKeywords, pMasterPage, pEditDate, pBody, pBodyPage)" +
                             " SELECT '" + pNameSQL + "' AS pName, pTitle, pText, mTitle, mDescription, mKeywords, pMasterPage, pEditDate, pBody, pBodyPage " +
                            "FROM  rc_Pages AS rc_Pages_1 WHERE (pName = @0)";
               db.Execute(copyPage, fromPage);
               var copyId = db.GetLastInsertId();
              //copy widget( deleted for space)

                Response.Redirect("Editpage.cshtml?id=" + copyId );
             var sqlIN = "Insert into rc_Pages "
            + "(pName, pTitle, pText, mTitle, mDescription, mKeywords, pMasterPage, pEditDate, pBody, pBodyPage) values "
            + "(@0, @1, @2, @3, @4, @5, @6, @7, @8, @9)";

                 db.Execute(sqlIN, pName, pTitle, pText, mTitle, mDescription, mKeywords, pMasterPage, pEditDate, pBody, pMasterPage);
                 Response.Redirect("Editpage.cshtml?id=" + db.GetLastInsertId());
             catch (Exception ex)

                 errMSG = ex.Message.ToString();

in the EditPage.cshtml:

    //List all Layout files
    DirectoryInfo dirInfo = new DirectoryInfo(Server.MapPath("~/rcLayouts"));
    FileInfo[] fileInfo = dirInfo.GetFiles("_*.cshtml", SearchOption.TopDirectoryOnly  );

    // list all the body pages
    DirectoryInfo dirInfoBody = new DirectoryInfo( Server.MapPath( "~/rcTemplates/Body" ) );
    FileInfo[ ] fileInfoBody = dirInfoBody.GetFiles( "_*.cshtml", SearchOption.TopDirectoryOnly );

    var pId = Request[ "id" ];
    var errMSG = "";


    var pMasterPage = data.pMasterPage;
    var pBodyPage = data.pBodyPage;
    var pEditDate = data.pEditDate;

        pMasterPage = Request[ "pMasterPage" ];
        pBodyPage = Request[ "pBodyPage" ];
        pEditDate = DateTime.Now;
        pBody = false;
        if(Request["pBody"] == "on"){
            pBody = true;

        var sqlUpdate = "Update rc_Pages set "
            + "pTitle=@0, pText=@1, mTitle=@2, mDescription=@3, mKeywords=@4, pMasterPage=@5, pEditdate=@6, pBody=@7, pBodyPage=@9 "
            + "where pId=@8";

            db.Execute(sqlUpdate, pTitle, pText, mTitle, mDescription, mKeywords, pMasterPage, pEditDate, pBody, pId, pBodyPage);
            errMSG = "Data saved !";


                <label for="pBodyPage">Body Page:</label>
                <select id="pBodyPage" name="pBodyPage">
               @foreach (var f in fileInfoBody )
                <option value="@f.Name" @if(pBodyPage==f.Name){<text>selected="selected"</text>}>@rcFunctions.CleanRCNames(f.Name)</option>
                </select>  <img src="images/help.gif" alt="help" title="Page that will be used as a body. All body pages are in rcTempaltes/Body folder - you can add/change/modify them to fit your needs" />

This gives me the ability to create server side body sections with the same simplicity than creating widgets.

Do you think that these changes can be included in the main trunk?


May 29, 2012 at 4:36 PM


1) good to hear that you are working on new add-ons. if this add-on will be available for free, i will be more than happy to list it on If this will be paid addon - send it to me for testing and if everything works i can list it and give link to your site where people can buy it/download it

2) i think that new version 1.0.5 will have 2 extra columns in rc_Pages table
- rcPage (True/False) - this is ready. You can use it when you create add-ons to mark page as actual "page" or someting else ex. storage for add-on.
I was testing site with 1000+ news pages (news addon that allows users to create categories and articles within that categories) and the problem was that all the news pages where visible when you wanted to use simple menu, or create new page based on existing one etc. so now by setting rcPage to False you can hide them from all that places.

- pBodyFile (nvarchar 50) - this is your pBodyPage (good idea).  it will work like wFile in rc_Widgets table
For now i'm 90% that i will add this, but i still have to think about this

To be honest with you the original idea was to use widget for everything, so if you want use diffrent body, you could set render body to false, and reder any widget in that place. example based on _rcVegetable layout
@RenderBody() - set to false in rcAdmin when you create/edit page
@RenderSection("rcBottom",false ) - any widget here, that way you could render widgets from rcAddons folder too
so when you create addon you could always, include everything in 2 folders, one that goes to rcaddons folder and one that goes to rcAdmin folder.

Anyway i see the point of adding this column even for non addon use...



May 31, 2012 at 4:56 PM


99.9% :) the extra column will be in the next ver. of razorC

can you send me the blog and e-commerce addon - as i said i would love to test it and put it on 

Will you offer the add-ons for free ? - let me know