-
Notifications
You must be signed in to change notification settings - Fork 370
Home
Welcome to the idiorm wiki!
Sorry if this is not the place to discuss this, this isn't a guide or tutorial, just a brainstorm on how to make idiorm more useful for chemists. I was previously using XCrud and found it too restricted in the way it forces you to output the database results in specific ways, but it had some good features like callback functions that could be applied to any field. I've literally only been using idiorm for a couple of days so I don't know whats what, but if you want to display molecular formulas (i.e. H2SO4) without having to manually enter the subscripts, heres a simple callback function for your molecular formula field:
function molecularFormula($value, $fieldname, $primary_key, $row, $xcrud)
{
return preg_replace('/([A-Z)])([0-9]+)/', '\1<sub>\2</sub>', $value);
}
To display ions and chemical equations, you need more complex functions and in my opinion its best to use MathJAX for that. There is a plugin for MathJAX called mhchem which is the ultimate chemistry parser. I'm an open source man myself and appreciate free software so I'll make a plugin geared towards scientists in the future if thats possible.