DEV Community

Cover image for How to create a plugin for Elanat?
elanatframework
elanatframework

Posted on

How to create a plugin for Elanat?

Introduction

Elanat is the most powerful .NET CMS. Elanat is a new CMS introduced in 2023. None of the similar .NET systems can be compared to Elanat, neither in terms of unique add-on-oriented structure nor in terms of size. Elanat's architecture is very modern and it is created based on server-side independence. It is interesting to know that the initial implementation of Elanat based on server-side independence caused the transition from .NET Standard version 4.5 to .NET Core version 7.0 to take less than 2 weeks (not counting the preparation of the new version release). Elanat supports eight add-on models, which will even reach 15 including templates, styles, languages, and other items; It is interesting to know that the number of add-ons kind in all systems similar to .net and php will not reach 15.

As promised, we will try to provide the .NET Core version of Elanat framework in August 2023. Before we try to present the new version, we decided to teach how to make add-ons of the plugin type. So that developers can practice creating plugins before releasing a new version in Elanat dot NET Core version.

This tutorial is for Elanat framework version 2, which is implemented with .NET Core 7.0.
You need to add CodeBehind package from nuget in your plugin project.

tip :
Remember that after the release of the new version, we will soon add the raw package (hello world!) of the plugin in nuget, so that developers can access the core Elanat dlls to create their plugins very quickly.

Plugins are placed in Elanat in wwwroot/add_on/plugin/yourplugin; your plugin will be automatically added to the directory you specify. This notification was for you to know about the path of your plugin!

Step 1:

Create empty project
Create an empty ASP.NET Core 7.0 project then add CodeBehind nuget package
https://www.nuget.org/packages/CodeBehind

Step 2:

Create Model and View and Controller

View page file

<%@ Page Controller="Elanat.YourController" Model="Elanat.YourModel" %><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title><%=model.PageTitle%></title>
</head>
<body>
    <%=model.BodyValue%>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

Controller class file

using CodeBehind;

namespace Elanat
{
    public partial class YourController: CodeBehindController
    {
        public YourModel model = new YourModel();
        public void PageLoad(HttpContext context)
        {
            model.PageTitle = "Hello World! In Title";
            model.BodyValue = "Hello World! In HTML Body";
            View(model);
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

Model class file

using CodeBehind;

namespace Elanat
{
    public partial class YourModel : CodeBehindModel
    {
        public string PageTitle { get; set; }
        public string BodyValue { get; set; }
    }
}
Enter fullscreen mode Exit fullscreen mode

Program.cs class file

var builder = WebApplication.CreateBuilder(args);

var app = builder.Build();

app.Run();
Enter fullscreen mode Exit fullscreen mode

The README.md file in the CodeBehind framework repository provides a complete description of programming with this framework. You can run your project according to the README.md file description. Please note that for the final publication, the Program.cs class must be in accordance with this tutorial(Program.cs class file in step 2).
https://github.com/elanatframework/Code_behind

Step 3:

Download raw add-on file of the plugin
The below link is the raw add-on file of the plugin:
https://elanat.net/upload/english_presentation_download_center/plugin.zip

Step 4:

Publish your project
First, extract the zip file; after extracting the zip file, you will see two directories; in the directory with the same name as the Add-on type, delete the index.html file and add your executable file in this directory. You can add as many files as you want in the Elanat path in the root directory.
Place the project dll file in the bin directory in the root directory. Note that there is no need to add CodeBehind.dll and you only need to add your project dll file along with the dlls you used in the project.

Step 5:

Fill catalog.xml file
In the directory with the same name as the add-on type, open the catalog.xml file for editing and change or add the necessary values such as add-on name, add-on path, add-on executable file name, etc. Finally, create a zip file containing the directory with the same name as the add-on type and the root directory.

In the links below, the codes of 3 module-type add-ons and one component-type add-on are available:

https://github.com/elanatframework/Elanat_add-ons/tree/elanat_framework/module/elanat_slideshow
https://github.com/elanatframework/Elanat_add-ons/tree/elanat_framework/module/elanat_gallery
https://github.com/elanatframework/Elanat_add-ons/tree/elanat_framework/module/elanat_faq
https://github.com/elanatframework/Elanat_add-ons/tree/elanat_framework/component/sql_command

Links:

Website
https://elanat.net

Elanat framework repository
https://github.com/elanatframework/Elanat

Elanat external add-on repository
https://github.com/elanatframework/Elanat_add-ons

CodeBehind backend framework repository
https://github.com/elanatframework/Code_behind

Top comments (0)