From b8c98693f81d9cc346a44f3897fd9b9ac0d0b37a Mon Sep 17 00:00:00 2001 From: stas Date: Mon, 1 Jul 2024 13:09:43 +0300 Subject: [PATCH] add postModel --- index.php | 3 ++- post.php | 29 +++++++++++++++++++++++++++++ post.txt | 4 ++++ src/models/PostModel.php | 31 +++++++++++++++++++++++++++++++ views/post.php | 14 ++++++++++++++ 5 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 post.php create mode 100644 post.txt create mode 100644 src/models/PostModel.php create mode 100644 views/post.php diff --git a/index.php b/index.php index 339305e..ece59c0 100644 --- a/index.php +++ b/index.php @@ -4,4 +4,5 @@ namespace src; require_once "vendor/autoload.php"; -require "views/form.php"; +require "views/post.php"; +//require "views/form.php"; diff --git a/post.php b/post.php new file mode 100644 index 0000000..0274617 --- /dev/null +++ b/post.php @@ -0,0 +1,29 @@ +load($_REQUEST); +$post->save(); + +$post1 = new PostModel(); + +$res = $post1->find(['author' => ['Stas']])->limit(10)->all(); + +$json = new Processing(); +$infArr = $json->createJsonArray($post->labels(), $res, "form2"); + +$table = new \Itguild\Tables\ListJsonTable($infArr); +$table->create(); +$table->render(); \ No newline at end of file diff --git a/post.txt b/post.txt new file mode 100644 index 0000000..d070af1 --- /dev/null +++ b/post.txt @@ -0,0 +1,4 @@ +autoincrement=id;last_id=2;table_name=post +id;author;post +1;Stas;Hello, world!!! +2;Stas;Hello, world!!! diff --git a/src/models/PostModel.php b/src/models/PostModel.php new file mode 100644 index 0000000..232efff --- /dev/null +++ b/src/models/PostModel.php @@ -0,0 +1,31 @@ + 'Автор', + 'post' => 'Пост' + ]; + } +} \ No newline at end of file diff --git a/views/post.php b/views/post.php new file mode 100644 index 0000000..882358c --- /dev/null +++ b/views/post.php @@ -0,0 +1,14 @@ +
+ Автор:
+

+ + Пост:
+

+ + + +
\ No newline at end of file