function loadWeb()
 {
     $html = new HtmlDocument();
     echo $html->seccionHead();
     echo $html->seccionSuperior($this->idiomas);
     echo $html->seccionCentral();
     echo $html->seccionInferior();
 }
示例#2
0
 public function query($expression, \DOMNode $contextNode = null, $registerNodeNs = true)
 {
     // if no context node has been given, assume <body>
     if (null === $contextNode) {
         $contextNode = $this->getDocument()->getElementsByTagName('body')->item(0);
         // make sure the query is relative to the context node
         if ($contextNode && '' !== $expression && '.' !== $expression[0]) {
             $expression = '.' . $expression;
         }
     }
     return parent::query($expression, $contextNode, $registerNodeNs);
 }
示例#3
0
    private $strategy;
    public function __construct($strategy)
    {
        $this->stategy = $strategy;
    }
    public function getHtml()
    {
        return "<html><body>" . $this->stategy->getContents() . "</body></html>";
    }
}
interface HtmlContentStrategy
{
    public function __construct($name);
    public function getContents();
}
class HelloWorldStrategy implements HtmlContentStrategy
{
    var $world;
    public function __construct($world)
    {
        $this->world = $world;
    }
    public function getContents()
    {
        return "Hello" . $this->world . "!";
    }
}
$hello = new HelloWorldStrategy('aaa');
echo $hello->getContents();
$html = new HtmlDocument('HelloWorldStrategy');
echo $html->getHtml();
示例#4
0
}
$pages = $styles = array();
foreach (glob('example' . DIRECTORY_SEPARATOR . '*.php') as $file) {
    $pages[] = pathinfo($file)['filename'];
}
foreach (glob(RTK_DIRECTORY . 'style' . DIRECTORY_SEPARATOR . '*') as $dir) {
    $styles[] = RTK::RemovePrefix(pathinfo($dir)['filename'], 'rtk-');
}
if (!in_array($showpage, $pages)) {
    $showpage = $pages[0];
}
if (!in_array($showstyle, $styles)) {
    $showstyle = $styles[0];
}
// create the requested page
$RTK = new HtmlDocument("RTK example test site");
$RTK->ClearStylesheets();
$faviconpath = 'image' . DIRECTORY_SEPARATOR . 'favicon.png';
if (file_exists($faviconpath)) {
    $RTK->SetFavicon($faviconpath);
}
$RTK->AddStylesheet(RTK_DIRECTORY . 'style/rtk-' . $showstyle . '.css');
$RTK->AddStylesheet('style' . DIRECTORY_SEPARATOR . 'style.css');
$topbar = new RTK_Box('topbar');
$pagestyleform = new RTK_Form('pagestyleform', 'index.php', 'GET', false);
$pagestyleform->AddDropDown('page', 'Page:', $pages, $showpage);
$pagestyleform->AddDropDown('style', 'Style:', $styles, $showstyle);
$topbar->AddChild($pagestyleform);
$button = new RTK_Button();
$button->AddAttributes(array('onclick' => "document.getElementById('pagestyleform').submit()"));
$topbar->AddChild($button);