https://github.com/tina4stack/tina4php-shape
HTML Language called Shape where you write code to make HTML
https://github.com/tina4stack/tina4php-shape
Last synced: 8 months ago
JSON representation
HTML Language called Shape where you write code to make HTML
- Host: GitHub
- URL: https://github.com/tina4stack/tina4php-shape
- Owner: tina4stack
- Created: 2021-07-03T13:07:11.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-11T13:12:01.000Z (over 2 years ago)
- Last Synced: 2025-03-26T20:21:41.066Z (about 1 year ago)
- Language: PHP
- Size: 351 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tina4php-shape
HTML Language called Shape where you write code to make HTML
### Installation
```bash
composer require tina4stack/tina4php-shape
```
### Basic usage
Each HTML tag has an underscore prefix, `
` tag would be `_p()`
#### Normal Tag
```php
echo _p("Hello"); //
Hello
```
#### Tag with Attributes
```php
echo _div(["class" => "form-group"], "Testing"); //
Testing
```
#### Nesting of tags
Some things become easier to code due to nesting, think of un ordered lists or select tags.
```php
$lis = [];
$lis[] = _li("One");
$lis[] = _li("Two");
$ul = _ul ($lis);
$options = [];
$options[] = _option("One");
$options[] = _option("Two");
$select = _select (["name" => "choose"], $options);
```
#### Finding a tag by id
Sometimes you want to manipulate a tag's content, so we find it based on the id attribute.
```php
$tag = $html->byId("someId");
```
#### Set the html of a tag
```php
$tag->html(_p("Changed HTML"));
```
### Example
```php
"en"],
_head(
_title("Testing")
),
_body(
_h1(["id" => "someId"],"Hello World! H1"),
_h2("Hello World! H2"),
$a = _h3("Hello World! H3"),
_h4("Hello World! H4"),
_h5("Hello World! H5"),
$ul
)
));
$a->html(_b(["style" => "color: red"],"Hello"));
$html->byId("someId")->html("=====");
echo $html;
```
You should see something like this
