Skip to content

Commit e221bfb

Browse files
author
AFN
committed
View Class Development Completed
View class can be used smoothly.
1 parent 2160f62 commit e221bfb

File tree

6 files changed

+366
-1462
lines changed

6 files changed

+366
-1462
lines changed

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,57 @@ Enter this command:
3838
$ docker-compose up -d --build
3939
```
4040

41+
## HOW TO CREATE NEW PAGE
42+
43+
Firstly call View class:
44+
```
45+
$view = new View();
46+
```
47+
48+
After that, you should imply the path of view file(you don't need to enter full path. Ex: index Ex2: alerts/successful):
49+
```
50+
$view->view_file = "index";
51+
```
52+
53+
If you want to add other template files to your actual page, you should push file paths into array object of add_files as the following:
54+
```
55+
$view->add_files = [
56+
'header' => 'header_fixed',
57+
'alert_box' => 'alert_box_error'
58+
];
59+
```
60+
61+
You can use new_entry function to add data. First parameter is type of your data which defines regex and second paramter is array of your data. Your data should be entered as a array value and it should have an unique identifier as a array key.
62+
```
63+
$view->new_entry(1, [
64+
'test' => 'This was a test data!',
65+
'test2' => 'Lorem ipsum dolor. Sit amet orci. In et molestie interdum vitae libero varius felis nunc pellentesque ut venenatis interdum volutpat vitae amet nec leo orci vulputate massa.',
66+
'test3' => 'Lorem ipsum dolor. Sit amet orci. In et molestie interdum vitae libero varius felis nunc pellentesque ut venenatis interdum volutpat vitae amet nec leo orci vulputate massa.',
67+
]);
68+
```
69+
70+
You can add loops to array of your data. It provides to push more than data. You have to give an unique name for each loop.
71+
```
72+
$view->new_entry(1, [
73+
'loop_1_1' => [
74+
'test' => 'I will',
75+
'test2' => 'love',
76+
'test3' => 'you',
77+
],
78+
'loop_1_2' => [
79+
'test' => 'until',
80+
'test2' => 'I',
81+
'test3' => 'die',
82+
],
83+
]);
84+
```
85+
86+
You can use new_entry function at choice, so you don't have to push all your data in one go.
87+
88+
Start view processes and echo view page:
89+
```
90+
echo $view->generate_markup();
91+
```
4192

4293
## HINTS
4394

0 commit comments

Comments
 (0)