File: demo.php

package info (click to toggle)
php-texy 2.6-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 680 kB
  • sloc: php: 4,754; makefile: 4
file content (39 lines) | stat: -rw-r--r-- 762 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php

/**
 * This demo shows how enable emoticons in Texy!
 */


// include Texy!
require_once dirname(__FILE__) . 'Texy.php';


$texy = new Texy();


// EMOTICONS ARE DISABLED BY DEFAULT!
$texy->allowed['emoticon'] = TRUE;

// configure it
$texy->emoticonModule->class = 'smilie';
$texy->emoticonModule->icons[':oops:'] = 'redface.gif';  // user-defined emoticon


// processing
$text = file_get_contents('sample.texy');
$html = $texy->process($text);  // that's all folks!

// CSS style
header('Content-type: text/html; charset=utf-8');
echo '<style type="text/css"> .smiley { vertical-align: middle; } </style>';

// echo formated output
echo $html;


// and echo generated HTML code
echo '<hr />';
echo '<pre>';
echo htmlSpecialChars($html);
echo '</pre>';