An open API service indexing awesome lists of open source software.

https://github.com/kcreate/ptf

PHP Tag Formatting (or short PTF)
https://github.com/kcreate/ptf

Last synced: 9 months ago
JSON representation

PHP Tag Formatting (or short PTF)

Awesome Lists containing this project

README

          

## PTF
* Stands for PHP-Tag-Formatting
* Easily implementable
* Fast (i guess?)
* See an example here: http://leonardschuetz.ch/projects/PTF/source.php

## Installation
Installation is actually pretty easy. Just download the ls_ptf.php file and include it into your project.

## Usage and pre-supported tags
To format all the tags inside a string just write:
```
$a = "Click this #a#http://awesomesite.com - link#a#";
$b = parse($a);
// $b will be "Click this link"
```
### `#a#`
```
#a#url - title#a# // regular notation.
#a#url#a# // short notation, title will always be Link unless changed.
```

### `#img#`
```
#img#url#img# // regular notation.
```

### `#hl#`
```
#hl#some text#hl# // regular notation, puts wrapped text in a element with a class called "highlight".
```

### `#h#`
```
#h#title#h# // regular notation, puts wrapped text in a

element.
```

### `#qo#`
```
#qo#awesome cite ~ Leonard Schuetz#qo# // regular notation, puts wrapped text in a

element.
```

## Customization
Change the definitions in the parse() function to choose which, and how the tags are being outputted.
For example if you want #github#PTF#github# to result in this: `PTF`
You'd write:
```
if (str_contains('#github#', $value)) {
$value = parseTag('#github#', $value, "", '');
}
```
#### Parameters:
* Tag
* String
* What to replace the opening tag with
* What to replace the closing tag with