I’m planning on coding a little basic cms and got some questions.
Imagen you have a Navigation like this:
Home --> www.foo.com/home
About Us --> www.foo.com/about_us
Contact --> www.foo.com/contact
Each of them are a controller and sub navigation could be actions. Imagen now, you have a button “Add Navigationpoint” so a user can add a new page. He will add the page “News”, so now I’d need to create a controller and an index action and maybe some other actions.
Basically, this is no problem. I could just generate a string and create the file. But whats the nice way? Somehow i think, this is wrong.
Note: I don’t want to use any databases. Also i will try to change the views from .phtml to .html and use js. Passing json from the controller to my view.
The goal is the following: The user should be able to add a new page, type in the template of that page, add a css and some js files. I’ll save the whole homepage structure on the filesystem.
My idea is to create a helper which checks e.g. if the according view exists. So i don’t need controllers and actions at all.
Anyway, I’m quite unsure, hope you understood me.
The reason why i want to have everything within .html files and use JS for templating is, that i want it to be live editable and most designers don’t know PHP Syntax. I really like mustache and since mustache needs JSON anyway, why not just use JS. Also i really like JS more then PHP. And the whole thing should be a little challenge, never done anything like this.
Thanks!
I would suggest not generating code controllers/actions for new “user submitted” pages.
I would suggest using a single controller for rendering/creating any “user submitted” pages.
For example the url could look like this:
News --> www.foo.com/custom/render/news