Cuyahoga is a well-known open-source website framework. It can easily add new function modules without modifying the framework itself. The following describes how to add a simple module to it.
We recommend that you create an independent project for each module to generate a single Program Set. Do not add any new modules to the Cuyahoga. Core Project, or you may encounter problems when upgrading the new version.
1. Create an Asp.net web application named cuyahogasamplemodule. The default namespace is Cuyahoga. modules. sample, and the Assembly name is Cuyahoga. modules. sample.
The directory structure is as follows:
you also need to add the following command in post-build event:
code highlighting produced by actipro codehighlighter (freeware)
http://www.CodeHighlighter.com/
--> xcopy / S / Y " $ (projectdir) " web \ * . as? X " $ (solutiondir) " web \ modules \ sample \
xcopy / S / Y " $ (projectdir) " web \ * . GIF " $ (solutiondir) " web \ modules \ sample \
Xcopy/S/Y"$ (Targetdir)"Cuyahoga. modules. sample. dll"$ (Solutiondir)"WEB \ bin \
After compilation, copy the module pages, images, and assembly files to the web directory.
2. Add a class named samplemodule. CS under the root directory as the module configuration management class.
This is the core class of the module. It is used to store some general functions not included in. ascx or Aspx. This class is derived from Cuyahoga. Core. domain. modulebase.
Code The following code is not required because this is the most basic example. Using System;
Using Cuyahoga. Core. domain; // Need to reference Cuyahoga. Core Assembly
Namespace Cuyahoga. modules. Sample
{
Public Class Samplemodule: modulebase
{
}
}
3. Add a new. ascx user control in the web directory to display the module content.
Cuyahoga is to embed the user control into the template to display the content. We write the "Hello world". ascx. CS class in the control to inherit the Cuyahoga. Web. UI. basemodulecontrol. Using System;
Namespace Cuyahoga. modules. Sample
{
// You need to reference Cuyahoga. Web assembly
Public Partial Class Sample: Cuyahoga. Web. UI. basemodulecontrol
{
Protected Void Page_load ( Object Sender, eventargs E)
{
}
}
}
3. Add a record to the cuyahoga_moduletype table so that Cuyahoga knows how to create a module instance.
All installed modules are registered in this table. The information of this module is the module name, assembly name, module controller class name, path (under the web directory), and date. Insert Into Cuyahoga_moduletype (name, assemblyname, classname, path, updatetimestamp) Values ( ' Sample ' ,
' Cuyahoga. modules. Sample ' , 'Cuyahoga. modules. sample. samplemodule ' , ' Modules/sample. ascx ' , Getdate ())
In this way, a new module is added. After compilation, the module is added to a section on the background management page, and the effect is displayed.
Most of the content in this article comes from the official help documentation http://www.cuyahoga-project.org/. Created by jecray