I have a page type that, at times, my client has wanted me to update the amount of rows and columns that are available to add content into. Rather than having to manually add more page properties I want to run a function that takes a row and column amount to append the static $db variable. Is there a scope in which I can run this function so that the reflection on the $db variable can still take place?
It is possible to read the php file, modify it, write it back to disk and then trigger a dev/build -sure.
"self-modifying" code is seen as a bad practice - I'd say it was because the code could wipe itself out and damage the system. This is because code can have mistakes, when it modifies itself with a mistake it would be magnified. "automatic programming" on the other hand (using software to create software) would be much better... I'm looking forward to SilverSmith by UncleCheese (http://www.leftandmain.com/silverstripe-screencasts/2011/04/11/the-silversmith-framework-code-right-type-less-build-fast/)- shouldn't be long now...
Yeah editing the code = bad idea. You should take a look at your data model, if you need to create multiple instances of the same thing then you should be looking to create a has_many relationship or splitting out those fields to another object that you can repeat.
has_many generally relies on popup editors, does it not?
TableListFields (like the one in 'Security') can also do simple fields inline in the table which works well if you have title -> link type data.