-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from bim-g/layout
[DOC] update documentation
- Loading branch information
Showing
7 changed files
with
56 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,39 @@ | ||
# wepesi-view | ||
Simple view engine, just to share data across pages | ||
Simple view engine, and share data across pages | ||
|
||
# Introduction | ||
|
||
Create directory where all the view file will loaded. eg: `views` | ||
the class has few method to be used in order to make your view work as expected. | ||
* `assign` : help assign a value to the variable. It has two parameters, the first is the name of the variable and the second parameter is the value of the variable. | ||
* `render` : helps display the contents of your file. Is like a parameter, and it's the name of the file. | ||
Note: All files must be defined in the root directory of the view. | ||
* `setLayout` : help set the layout of the pages. | ||
|
||
# Installation | ||
```bash | ||
composer require wepesi/view | ||
``` | ||
|
||
# Usage | ||
## Without layout | ||
|
||
```php | ||
$view_dir = __DIR__."/views"; | ||
$view = new \Wepesi\App\View($view_dir); | ||
$view->assign("title","Welcom to the main pages"); | ||
|
||
$view->render("/art"); | ||
``` | ||
|
||
## With layout | ||
In case you are want to set the layout, you should define the `$contentpages` variable into your layout file where the view content will be applyed. | ||
```php | ||
$view_dir = __DIR__."/views"; | ||
$view = new \Wepesi\App\View($view_dir); | ||
$view->assign("title","Home page"); | ||
|
||
view->setLayout("/layout"); | ||
$view->render("/home"); | ||
``` | ||
No need to specify the extension in case it is a php file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
<p><i class="fa fa-envelope-o w3-text-teal w3-xlarge"></i> [email protected]</p> | ||
</div> | ||
<div class="w3-col m7"> | ||
<form class="w3-container w3-card-4 w3-padding-16 w3-white" action="/action_page.php" target="_blank"> | ||
<form class="w3-container w3-card-4 w3-padding-16 w3-white" action="https://github.com/bim-g/wepesi-view" target="_blank"> | ||
<div class="w3-section"> | ||
<label>Name</label> | ||
<input class="w3-input" type="text" name="Name" required> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters