Software:Sansa Framework: Difference between revisions
(over-write) |
Importwiki (talk | contribs) (import) |
||
Line 1: | Line 1: | ||
{{Proposed deletion/dated | |||
|concern = WP:NOTHOWTO. | |||
|timestamp = 20240620144953 | |||
|nom = Let'srun | |||
|help = off | |||
}} | |||
{{Multiple issues| | |||
}} | |||
'''Sansa Framework''' is a structure to create [[Organization:PHP|PHP]] web applications using the [[Model–view–controller|model–view–controller]] (MVC) model, it's a web application that must be installed in a server to work, could be installed in a test server or in production server. The developer must create a data model and do all the changes the project need and at any time generate the model. The generation creates a database in MySQL server with the same name of the model and a ''n''-tier layer of libraries to handle the database. | '''Sansa Framework''' is a structure to create [[Organization:PHP|PHP]] web applications using the [[Model–view–controller|model–view–controller]] (MVC) model, it's a web application that must be installed in a server to work, could be installed in a test server or in production server. The developer must create a data model and do all the changes the project need and at any time generate the model. The generation creates a database in MySQL server with the same name of the model and a ''n''-tier layer of libraries to handle the database. | ||
To insert a new record to the table, create a new instance of a class, fill the properties and call the insert method. | To insert a new record to the table, create a new instance of a class, fill the properties and call the insert method. | ||
< | <syntaxhighlight lang="php"> | ||
$usr = new users(); | $usr = new users(); | ||
$usr->name = "test"; | $usr->name = "test"; | ||
$usr->insert(); | $usr->insert(); | ||
</ | </syntaxhighlight> | ||
The code above insert one record to the table '''users''' with the name '''test'''. | The code above insert one record to the table '''users''' with the name '''test'''. | ||
< | <syntaxhighlight lang="php"> | ||
$usr = new users(); | $usr = new users(); | ||
if ($usr->get("name")->where("id=1")->exe()) { | if ($usr->get("name")->where("id=1")->exe()) { | ||
Line 17: | Line 26: | ||
} | } | ||
} | } | ||
</ | </syntaxhighlight> | ||
The code above print '''test.''' | The code above print '''test.''' | ||
< | <syntaxhighlight lang="php"> | ||
$usr = new users(1); | $usr = new users(1); | ||
echo $usr->name; | echo $usr->name; | ||
</ | </syntaxhighlight> | ||
The code above print '''test''' too. | The code above print '''test''' too. | ||
'''Complex code:''' | '''Complex code:''' | ||
< | <syntaxhighlight lang="php"> | ||
public function save($arr) | public function save($arr) | ||
{ | { | ||
Line 44: | Line 53: | ||
return $result; | return $result; | ||
} | } | ||
</ | </syntaxhighlight> | ||
The code below shows how to create joins. | The code below shows how to create joins. | ||
< | <syntaxhighlight lang="php"> | ||
require($_SERVER['DOCUMENT_ROOT'] . '/layers/bll/users.php'); | require($_SERVER['DOCUMENT_ROOT'] . '/layers/bll/users.php'); | ||
require($_SERVER['DOCUMENT_ROOT'] . '/layers/bll/rights.php'); | require($_SERVER['DOCUMENT_ROOT'] . '/layers/bll/rights.php'); | ||
Line 64: | Line 73: | ||
} | } | ||
} | } | ||
</ | </syntaxhighlight> | ||
==External links== | ==External links== |
Revision as of 16:24, 21 June 2024
Please use PROD only on articles. It is proposed that this article be deleted because of the following concern:
If you can address this concern by improving, copyediting, sourcing, renaming, or merging the page, please edit this page and do so. You may remove this message if you improve the article or otherwise object to deletion for any reason. Although not required, you are encouraged to explain why you object to the deletion, either in your edit summary or on the talk page. If this template is removed, do not replace it. The article may be deleted if this message remains in place for seven days, i.e., after 14:49, 27 June 2024 (UTC). Find sources: "Sansa Framework" – news · newspapers · books · scholar · JSTOR |
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
(Learn how and when to remove this template message)No issues specified. Please specify issues, or remove this template. |
Sansa Framework is a structure to create PHP web applications using the model–view–controller (MVC) model, it's a web application that must be installed in a server to work, could be installed in a test server or in production server. The developer must create a data model and do all the changes the project need and at any time generate the model. The generation creates a database in MySQL server with the same name of the model and a n-tier layer of libraries to handle the database.
To insert a new record to the table, create a new instance of a class, fill the properties and call the insert method.
$usr = new users(); $usr->name = "test"; $usr->insert();
The code above insert one record to the table users with the name test.
$usr = new users(); if ($usr->get("name")->where("id=1")->exe()) { if ($usr->count > 0) { foreach ($usr->dobj as $d) { echo $d->name . "<br>"; } } }
The code above print test.
$usr = new users(1); echo $usr->name;
The code above print test too.
Complex code:
public function save($arr) { $result = false; $this->arr_to_prop($arr); //this method clear the array of risky code and //assign $this->name = $arr['mappname'] and any other property. $index = $arr['index']; if ($index == 0) { // new $result = $this->insert(); } else { // edit if (isset($_SESSION['dusers'])) { $id = $_SESSION['dusers'][$index]['id'] $result = $this->update($id); } } return $result; }
The code below shows how to create joins.
require($_SERVER['DOCUMENT_ROOT'] . '/layers/bll/users.php'); require($_SERVER['DOCUMENT_ROOT'] . '/layers/bll/rights.php'); require($_SERVER['DOCUMENT_ROOT'] . '/layers/bll/access.php'); $u = new users(); if ($u->join($r = new rights())->on(array($u->rightid(), EQUAL, $r->id())) ->join($a = new access())->on(array($r->idaccess(), EQUAL, $a->aid())) ->get(array($u->name(), $r->rname(), $a->aname())) ->exe()) { // echo $u->sqlstr . "<br><br>"; // print the resulting sql if you need it. foreach ($u->dobj as $d) { echo $d->name . " " . $d->rname . " " . $d->aname . "<br>"; } }
External links
Original source: https://en.wikipedia.org/wiki/Sansa Framework.
Read more |