how to naming the model, view, controller files?
Permalink 2 users found helpful
1. How to naming the model, view, controller files in concrete5 ?
2. How to naming the controller class ?
if i had a single_pages file in my directory path
I also created my controller file my directory path
How can i give the controller class name ?
3. There is any restriction to naming the models file?
and the directory path should be same ?
anyone could explain it plzzzzzz....
Thanks in advance...
2. How to naming the controller class ?
if i had a single_pages file in my directory path
Dashboard/MyProfile/MyfileA.php
I also created my controller file my directory path
Dashboard/MyProfile/MyfileA.php
How can i give the controller class name ?
3. There is any restriction to naming the models file?
and the directory path should be same ?
anyone could explain it plzzzzzz....
Thanks in advance...
if i give the name to my file
can i use controller class name
like this?
there is no case sensitive issue in it ?
/controllers/dashboard/myprofile/myfilea.php
can i use controller class name
DashboardMyProfileMyFileAController
there is no case sensitive issue in it ?
Yes, that is the class name you would use. It has to be camel cased.
if i use the directory structure like this:
It my sub directory MyProfile already contains the camel case, and my file name (MyfileA.php) contains the alternate camel case...
In that case how can i use controller class name ?
/controllers/Dashboard/MyProfile/MyfileA.php
It my sub directory MyProfile already contains the camel case, and my file name (MyfileA.php) contains the alternate camel case...
In that case how can i use controller class name ?
I don't believe it would let you add two single pages named MyfileA.php and MyFileA.php.
If you had MyfileA.php and my_file_a.php their respective controller names would be:
And
Only the underscores are translated to camel case.
While this works, I would recommend you always use the concrete5 convention of naming your files with underscores. It will make life much easier for you.
If you had MyfileA.php and my_file_a.php their respective controller names would be:
DashboardMyProfileMyfileaController //this is for MyfileA
And
DashboardMyProfileMyFileAController //this is for my_file_a
Only the underscores are translated to camel case.
While this works, I would recommend you always use the concrete5 convention of naming your files with underscores. It will make life much easier for you.
ok... thanks for your clarification...
i have a little bit doubt in models directory...
if i use my view file in the directory path
i had a corresponding controller file in the directory path
How to place my corresponding model file...
is there is any restriction in directory path ?
i should use my directory path like this?
is this necessary ?
Please clear my doubt...
i have a little bit doubt in models directory...
if i use my view file in the directory path
/single_pages/Dashboard/Class/Myclass.php
i had a corresponding controller file in the directory path
/controllers/Dashboard/Class/Myclass.php
How to place my corresponding model file...
is there is any restriction in directory path ?
/models/Dashboard/Class/Myclassmodel.php
i should use my directory path like this?
is this necessary ?
Please clear my doubt...
No, you can just have your your model right in the models directory. So
Then you would do:
However, if it works better for you to put it in a subfolder for organizational purposes you can certainly do that. So if you have
You can load it in with:
Does that help?
/models/Myclassmodel.php
Then you would do:
Loader::model('Myclassmodel');
However, if it works better for you to put it in a subfolder for organizational purposes you can certainly do that. So if you have
/models/mymodels/Myclassmodel.php
You can load it in with:
Loader::model('mymodels/Myclassmodel');
Does that help?
Thank you for your response...
And two more questions i have...
1. There is any restrictions in naming for class in concrete5 mvc...?
2. In concrete5, they follow any standardized directory structure...?
And two more questions i have...
1. There is any restrictions in naming for class in concrete5 mvc...?
2. In concrete5, they follow any standardized directory structure...?
In concrete5, naming for class in controller...
It just read the
For standardized coding style guideline to understand other developers only they use camel case & give some restrictions to naming the directory and files also for classes...
i got this reference from vektor larsson...
Thanks to vektorlarsson (vlarsson)...
he pointing this link for me...
http://www.concrete5.org/documentation/developers/system/coding-sty...
thanks to you bbeng89 for clear my doubts about models directory and class naming format...
It just read the
class directorysubdirectoryfilenamecontroller
For standardized coding style guideline to understand other developers only they use camel case & give some restrictions to naming the directory and files also for classes...
i got this reference from vektor larsson...
Thanks to vektorlarsson (vlarsson)...
he pointing this link for me...
http://www.concrete5.org/documentation/developers/system/coding-sty...
thanks to you bbeng89 for clear my doubts about models directory and class naming format...
Crediting yourself with an 'answer' after getting help (which you acknowledged) is not nice nor in keeping with the open source community in which you both belong and benefit.
Please fix.
Please fix.
I should also mention that the concrete naming convention is to use underscores in file names. So you would probably want to call the file my_file_a.php. This wouldn't change the name of the controller though.
I don't believe there is any naming requirements for models. If you had a file: models/my_model_a.php you should be able to name the class whatever you want then load it in with
Hope that helps