Hello World Module

This is a tutorial to create "Hello World" Kooboo module. We assume that you already installed the Visual studio.NET module template. You can download the template from Kooboo website and then follow below steps to create a Hello world sample module

1, Create module



Open your Visual Studio.NET 2008, click file --> new --> project, open the project creation dialog. Enter "Kooboo.Cms.Helloworld" as project name and select the right file location.

2. Create and change configuration value



I am using Windows XP and already have a Kooboo instance running on http://localhost. If you need to install Kooboo, please refer to the Installation Guide.

Login to Kooboo, create an application called "HelloWorld"

Go to HelloWorld --> Design --> Layout template, select "New" button to create a new Layout template. Enter the name "LayoutTest", keep the rest, and then click "Save & Close".

Go to HelloWorld --> Page, click "New" to create a new page, enter the name "hellopage", select "LayoutTest" as the layout template, then click "save & close"

Now you have created a mock application & page, go back to your VS.NET module project, open web.config and change below value.

	
	


	
	
	



Please change the connectionStrings to your Kooboo instance, use the same value as when you first install Kooboo.

3. Create Hello World page.



Right click on "Controller" folder to add a new controller.

Enter the name as "HelloController", then click "Add" button.

You have created a controller, go to your controller file, right click on "Index()" method and then select "Add view"

On the view creation page, check "Create a partial view"
After a view is created, Visual Studio.NET will automatically open that file. Type text "Hello World"

Open routes.config, change the default controller to "Hello"
	
	
	
	
	



You can click "debug" in your VS.NET now. You should be able to see your Hello World page.

4. Deploy module



Open module.config file, throw away schema, sqlfile and folders section, because we do not use them in this sample. Your config file should look like below.


  1.0.0
  1.1.0
  false
  ExampleBlog/admin
  
    
      Key1
      Value1
    
  
  
    
      Everest.Cms.HelloWorld
      bin\Everest.Cms.HelloWorld.dll
      true
    
  



We do not use settings neither, but leave them there will not do any harm.

Go to the HelloWorld project folder in Windows explorer, you can zip everything in that folder into a helloworld.zip. That will work. However we recommend you at least throwing away the "lib" folder and most of the files in the "bin folder except "bin\Everest.Cms.HelloWorld.dll" as defined in module.config. Those files are necessary for development, but not needed for deployment.

Open your Kooboo site, go to helloworld --> Extension --> module

Click "Upload" button to upload the helloworld.zip file we just created.

After a module is uploaded, it is not installed by default. Select the module name, and click "install" button to install the module.

After module is installed, you can use it exactly the same way as a regular Content template.
Go to helloworld --> page, left click the page "hellopage" to open page configuration.

Click "Visual Design" to open visual designer. You should find "helloworld" module there. Drag and drop it to any position you defined in the Layout template.

Click "save & close" to close visual designer, and then click "save & close" again to close page configuration.

You have finished the Hello World example, right click on "hellopage" and select "preview" to preview your page.