Browse Source

v1.0 release

main 1.0
Vítězslav Dvořák 2 years ago
parent
commit
bde5f95a29
  1. 39
      Examples/page.php
  2. 3
      Examples/tabs.php
  3. 2
      nbproject/project.properties
  4. 49
      src/Ease/TWB4/WebPage.php

39
Examples/page.php

@ -0,0 +1,39 @@
<?php
namespace Ease\Example;
use Ease\Html\SpanTag;
use Ease\TWB4\Container;
use Ease\TWB4\Navbar;
use Ease\TWB4\WebPage;
include_once dirname(__DIR__) . '/vendor/autoload.php';
$page = new WebPage(_('Page Example'));
$page->addCss('
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px; /* Margin bottom by footer height */
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px; /* Set the fixed height of the footer here */
line-height: 60px; /* Vertically center the text there */
background-color: #f5f5f5;
}
');
$page->addToHeader(new Navbar('example', 'nav', []));
$page->addToMain('Main content');
$page->addToFooter(new Container(new SpanTag('Place sticky footer content here.'), ['class' => 'text-muted']));
echo $page;

3
Examples/tabs.php

@ -1,9 +1,10 @@
<?php
namespace Ease\Example;
use Ease\TWB4\Tabs;
use Ease\TWB4\WebPage;
namespace Ease\Example;
include_once dirname(__DIR__).'/vendor/autoload.php';

2
nbproject/project.properties

@ -20,4 +20,4 @@ tags.asp=false
tags.short=false
test.src.dir=${file.reference.ease-bootstrap4-tests}
testing.providers=PhpUnit
web.root=Examples
web.root=.

49
src/Ease/TWB4/WebPage.php

@ -10,8 +10,8 @@ namespace Ease\TWB4;
*
* @link http://twitter.github.com/bootstrap/index.html
*/
class WebPage extends \Ease\WebPage
{
class WebPage extends \Ease\WebPage {
/**
* Where to look for bootstrap stylesheet
* @var string path or url
@ -29,20 +29,57 @@ class WebPage extends \Ease\WebPage
* @var string path or url
*/
public $bootstrapJavaScript = 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.bundle.js';
public $header = null;
public $main = null;
public $footer = null;
/**
* Stránka s podporou pro twitter bootstrap.
*
* @param string $pageTitle
*/
public function __construct($pageTitle = null)
{
public function __construct($pageTitle = null) {
parent::__construct($pageTitle);
Part::twBootstrapize();
$this->head->addItem(
'<meta charset="utf-8">'.
'<meta name="viewport" content="width=device-width, initial-scale=1">'
'<meta charset="utf-8">' .
'<meta name="viewport" content="width=device-width, initial-scale=1">'
);
}
public function addToHeader($content) {
if (is_null($this->header)) {
$this->header = new \Ease\Html\HeaderTag();
}
return $this->header->addItem($content);
}
public function addToMain($content) {
if (is_null($this->main)) {
$this->main = new \Ease\Html\MainTag();
}
return $this->main->addItem($content);
}
public function addToFooter($content) {
if (is_null($this->footer)) {
$this->footer = new \Ease\Html\FooterTag();
}
return $this->footer->addItem($content);
}
public function finalize() {
if (is_null($this->header) === false) {
$this->addAsFirst($this->header);
}
if (is_null($this->main) === false) {
$this->addItem($this->main);
}
if (is_null($this->footer) === false) {
$this->addItem($this->footer);
}
parent::finalize();
}
}

Loading…
Cancel
Save