Code is Ruby script. The name of component's class must be the same as component's name. Besides, the component's class must inherit CKComponent.
class MainPage < CKComponent def sayHello "Hello World!" end end
To initialize in component, use init() that initializing method without arguments instead of initialize().
CGIKit binds elements in template to code. After binding, CGIKit shows HTML by converting the elements. Compoents and elements are changed to HTML like below.
<番号リスト-1->CGIKit reads template of the specified component.番号リスト-1->
<CGIKIT>
" is found, CGIKit searches the entry in ckd file which corresponds to the CGIKit tag in template. For example, if "<cgikit name=foo
>" is found in template, CGIKit looks for the entry of "foo
" in ckd file.
You need not to define accessor methods for instance variables to use with elements. CGIKit uses accessors if defined, or accesses instance variables directly.
In binding, the form data is assinged to the component through the methods to which you bind textfield, button and so on. You don't forget to define accessor methods.