End User Views

I’m not sure if what I’m thinking is possible. I have a need for a limited set of end users to be able to edit their own views, probably including layouts. These views could be stored on the filesystem or in the db and loaded at runtime. This would be for a kind of hosted management system where ideally users could modify the look and feel of the system themselves in addition to templates we supply them. However, I don’t want them to be able to access anything other than what I pass into the view via renderPartial, but I do want/need them to be able to do limited PHP code mostly for looping purposes. Am I correct in thinking this is impossible at runtime? So, if I wanted to do something like this, I think I would need to filter for it when the user submits the code for the view, but that would require knowing what to filter for and it seems like it would be impossible to account for.

Another solution is to disallow any code of any kind on their part and only have them edit the structure, but let them drop in placeholders for content that would be dynamically generated. If I do that, is there any easy way to implement that that isn’t too janky?

Has anyone given any thought into this sort of thing for Yii?

You can do it by following second approach i.e. giving placeholders

You should check theme structure of wordpress and allow editing of layouts based on file based system just like wordpress

Thanks

Thanks for the response. I’m familiar with Wordpress but that requires code, which I don’t think I can allow directly. So basically the standard solution here is to have placeholder blocks within the layout, like so?

{{maincontent}} - anything generated by views goes here

{{sidebar1}} - this could be something I can allow them to edit elsewhere

{{sidebar2}}

{{login_logout_block}} - where the user can login or logout

{{other_layout_blocks}} - anything else that will go on pages

and then for individual views I pretty much don’t let them edit any of the html…but if they upload their own css, then they can style it like they want assuming I give them plenty of classes and ID’s within the views to work with?

This too cool to use and it all depends on needs