PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Sergey Romanov   HTML Editor   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: HTML Editor
Compose and output HTML documents
Author: By
Last change: added new function example
Date: 19 years ago
Size: 1,284 bytes
 

Contents

Class file image Download
<?php
error_reporting
(E_ALL ^E_WARNING ^E_NOTICE);
include
'html_editor.php';

$editor = new Html_Editor;

$doc1 = $editor->newDocument('This is the title');

$editor->linkCss($doc1, '../main.css');

$meta = array(
   
'author' => 'Sergey Romanov',
   
'generator' => 'HTML-Kit'
);
$meta_http = array(
   
'content-type' => 'text/html; charset=windows-1251'
);
$editor->addMeta($doc1, $meta);
$editor->addMetaHttp($doc1, $meta_http);
$css = new CSS_Editor;
$h1 = $css->setElement('h1');
$property = array(
   
'color' => 'red',
   
'text-decoration' => 'underline'
);
$css->setProperties($h1,$property);

$css = $editor->getHtml('style', $css->getCss());

$editor->addHeadAdditions($doc1, $css);

$ba = array(
   
'margintop' => '0',
   
'marginwidth' => '0'
);
$editor->setBodyAttr($doc1,$ba);

$editor->writeHtml($doc1, 'h1','Hello World');
$text = 'This is an example text';
$text = $editor->highlightText('B class="test"',' is ',$text);
$text = $editor->highlightText('i',' example ',$text);
$editor->writeHtml($doc1,'p',$text);
$array = array('test it', 'once more', 'three to complete');
foreach(
$array As $k => $v){
   
$list .= $editor->getHtml('li',$v);
}
$editor->writeHtml($doc1, 'ul',$list);
$editor->docShow($doc1);

 
?>