Welcome Guest, Not a member yet? Register   Sign In
XML design for CodeIgniter Scaffolding (brainstorming)
#1

[eluser]tekhneek[/eluser]
I am in the process of designing a new system for CI that will allow me to design a database using conventions that I always use and turn that database design into an XML file that will then be used to create a CRUD type administrative interface. It's still in its infancy mainly as a concept. I don't have a working prototype or anything like that yet, just the idea.

This is the basic XML schema that I've been drafting to use for the DB -> XML migration.

Code:
<associations>
    <association config="default">
        <table>photo_galleries</table>
        <has>photos</has>
        <relationship>photo_galleries_photos</relationship>
    </association>
    <association config="denoted">
        <table id="id" foreign_id="fk_distributors_id">distributors</table>
        <has id="id" foreign_id="fk_categories_id">categories</has>
        <relationship>distributors_categories</relationship>
    </association>
</assocations>

The only reason for the DB -> XML instead of just creating the models/controllers/views directly from the database is customization -- in the future the CRUD generator will be able to take different directives in the XML to allow further customization and even validation rules on certain database fields if for example a column is "text" but it isn't supposed to be anything besides an email address. The reason for this is that the parser I'm going to write will know how to handle all of the language in the XML, but the transition from DB -> XML will be pretty standardized and consistent.

Imagine being able to create a database and just by normal database design conventions you barely have to customize anything and you have a fully functional CRUD with form validation, the ability to customize it anywhere you want and an XML based config instead of modifying controllers/views/models.

I'm not trying to create a "WYSIWYG" for CI by allowing you to just use the database design and then you're "done" more so a method for (me specifically) because I find myself building a lot of projects where a client wants an administrative panel and wordpress, expressionengine, or any other CMS is overkill, or doesn't do what they want to do at all.

I haven't started working on this too heavily yet which is why I'm posting here, I wanted some feedback from anyone that understands what I'm talking about doing here Tongue

Let me know what you think, it might be easier to understand if I make a prototype and show everyone.

Thanks.
#2

[eluser]tomcode[/eluser]
I am working on a similar projet, so far I collect all data in config files. I haven't thought yet further, since config <-> XML seems pretty straight forward to me, it's more a matter of knowing what info is needed to determine the structure.

I wouldn't use attributes, only plain nodes, keeping the parser easier.
#3

[eluser]Colin Williams[/eluser]
Other frameworks use YAML. I see nothing wrong with XML, I guess. The terminology is a bit weird though. Maybe stick to RESTful conventions instead?
#4

[eluser]Dam1an[/eluser]
I had a similar idea not too long ago, the idea was based on a proposed 3rd year project at Uni
Maybe you could take it a step further, and instead of going DB > XML > generated site, why not have XML > DB > generated site
This way, the database is created by running some scripts on the XML file

Another possible option, would be to use something like the Eclipse Modelling Framework to create a visual represenatation of the data and any relationships, and then have that generate the CI code and database tables
#5

[eluser]xwero[/eluser]
I think tags are good to structure documents but for metadata it's a bridge too far. I think YAML, JSON or even plain php arrays are better suited because of two things.

XML was build to have a computer and human readable format. But if i see a xml file most of the times i don't see the data because the tag overload. The shown snippet can be used as an example.

Because there are so many tags it makes the file fat.

In the case of php arrays you don't even need a format parser before you can begin to work with the metadata.
#6

[eluser]tekhneek[/eluser]
Good point. I'm going to keep playing with it and see what I come up with. Thanks for the replies.




Theme © iAndrew 2016 - Forum software by © MyBB