From 3004a6cafcaf0a4250bb64396775e85c3eb20faf Mon Sep 17 00:00:00 2001 From: Valkum Date: Wed, 29 Dec 2010 12:27:12 +0000 Subject: [PATCH] added some snippets for new model layout. with new database framework git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@921 a1433add-5e2c-0410-b055-b7f2511e0802 --- scripts/snippets/model.php | 47 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 scripts/snippets/model.php diff --git a/scripts/snippets/model.php b/scripts/snippets/model.php new file mode 100644 index 00000000..5c36ba0d --- /dev/null +++ b/scripts/snippets/model.php @@ -0,0 +1,47 @@ +insert($this->table, $this->values); + #pseudocode else + $db->update( $this->table, $this->id, $this->values ); + } + + public load( $parameter = array() ) { + ##pseudocode if where is key in parameters + $w = $parameters['where']; # where = array('column', 'value' ) + $sql = " WHERE $where['column'] = $where['value']"; + ## elseif limit is key in parameters + $l = $parameter['limit'] + $sq = " LIMIT $l[1], $l[2]"; + + + $db->query("SELECT * FROM $this->table $sql"); + } + + +} + + + + +//No closing tag only in index.php +//index.php needs drupal like path syntax like ?q=domain/new or ?q=domain/example.com or ?q=domain/example.com/edit +//which loads the needed controller and view. \ No newline at end of file