Hi,
I need to develop some CMP for my needs. I've went throught official "doodles" and "Custom Manager Pages" tutorial. I reviewed and tested MyComponent and MIGX plugin. I also own Official modx guide book, but there is only a briefly description about building CMP. I'm famigliar with MVC structure, but I have some problems here in MODX.
I don't have any knowledge of extJS, so I want to skip it for now (no time to learn it now) and develop my extras using some other JS library + html and of course object php programming.
I reviewed some of extras and followed varius tutorials ... and now I'm confused how things needs to be done. So if someone can explain me following questions I'll really appreciate it.
I plan to start developing my extra from build MyComponent creates it, but for some testing and to understand how it works I just created a folder "testcmp" under core/components + created namespace for it.
About main location od main index file.
in "custom-manager-pages" index file in root we create core/components/testcmp/index.class.php , in some examples is used only index.php in the root. Some other examples have index.class.php inside controllers folder.
1. Why is like that and what is the right way ?
a. core/components/testcmp/index.php
b. core/components/testcmp/index.class.php
c. core/components/testcmp/controllers/index.php
d. core/components/testcmp/controllers/index.class.php
2. I noticed that usualy ".class" in filename is present except index.php What is difference of index and index.class ??
3. When you create an action you can specify to use "controllers/index.class.php" which seens the right way to do it .. so if I'm correct in root "testcmp" folder we don't need any php files and all should go into "controllers" ? ... right ?
Anyway, after I followed "Custom Manager Pages" tutorial I wanted to pass some info to a "view". There is written to set a placeholder and "Simply add a getTemplateFile() method".
In doodle example I saw that a function is isnide home controller
public function getTemplateFile() { return $this->doodles->config['templatesPath'].'home.tpl'; }
When I aded this funcction to my example I got a blank page. Of course I changed "->doodles" to "->testcmp" and also created same name class inside core/components/testcmp/model/testcmp/testcmp.class.php with all configuration.
4. Inside core/components/testcmp/model why must be folder named "testcmp" and inside that is actual class?
Basicly what I want to accomplish is start wowking with MVC in modx.
5. So I need to know what is the right folder structures which is
M = core/components/testcmp/model/testcmp/...
V = anywhere inside core/components/testcmp/ ?? ... like /templates/ ?
C = core/components/testcmp/controllers/
and ... what are the right filenames.
6. How to call a model from a controller
7. How to pass data to a template view
8. Are any helpers in modx like in other frameworks .. if so .. wherw should be located and how you use them?
If anyone know for any "blank demo" wihout extJS on git repository please share it... or any other points to right direction.
Thanx