phpDocumentor page
[ class tree: page ] [ index: page ] [ all elements ]

Source for file Page.php

Documentation is available at Page.php

  1. <?
  2. /**
  3. * @package page
  4. * @filesource
  5. * @see HTML_PAGE_COMPONENT_PATH.'/Page.php'
  6. * @copyright (c) http://Finn-Rasmussen.com
  7. * @license http://Finn-Rasmussen.com/license/ myPHP License conditions
  8. * @author http://Finn-Rasmussen.com
  9. * @version 1.9
  10. * @since 21-oct-2005
  11. */
  12.  
  13. /**
  14. * The required files
  15. */
  16. require_once(HTML_PATH.'/Html.php');
  17. // Page Util
  18. require_once(HTML_BASE_PAGE_PATH.'/DocType.php');
  19. require_once(HTML_BASE_PAGE_PATH.'/HeadStart.php');
  20. require_once(HTML_BASE_PAGE_PATH.'/BodyStart.php');
  21. require_once(HTML_BASE_PAGE_PATH.'/Title.php');
  22. require_once(HTML_BASE_PAGE_PATH.'/Meta.php');
  23. require_once(HTML_BASE_PAGE_PATH.'/CssBase.php');
  24. require_once(HTML_BASE_PAGE_PATH.'/Javascript.php');
  25. require_once(HTML_BASE_PAGE_PATH.'/BodyEnd.php');
  26. require_once(HTML_BASE_PAGE_PATH.'/Noscript.php');
  27.  
  28. // Base Util
  29. require_once(HTML_BASE_UTIL_PATH.'/Link.php');
  30. require_once(HTML_BASE_UTIL_PATH.'/Image.php');
  31.  
  32. // Page Util
  33. require_once(HTML_PAGE_UTIL_PATH.'/Comment.php');
  34. require_once(HTML_PAGE_UTIL_PATH.'/Div.php');
  35. require_once(HTML_PAGE_UTIL_PATH.'/Document.php');
  36. require_once(HTML_PAGE_UTIL_PATH.'/Header.php');
  37. require_once(HTML_PAGE_UTIL_PATH.'/Hr.php');
  38. require_once(HTML_PAGE_UTIL_PATH.'/Iframe.php');
  39. require_once(HTML_PAGE_UTIL_PATH.'/Li.php');
  40. require_once(HTML_PAGE_UTIL_PATH.'/Ol.php');
  41. require_once(HTML_PAGE_UTIL_PATH.'/Paragraph.php');
  42. require_once(HTML_PAGE_UTIL_PATH.'/Span.php');
  43. require_once(HTML_PAGE_UTIL_PATH.'/Tag.php');
  44. require_once(HTML_PAGE_UTIL_PATH.'/Text.php');
  45. require_once(HTML_PAGE_UTIL_PATH.'/Ul.php');
  46.  
  47. // TODO Components
  48. // banner bannerif company copyright customer footer google iframe
  49. // metarotator imagerotator locator line
  50.  
  51. // TODO Links
  52. // bottommenu topmenu rightmenu menulink leftmenu
  53.  
  54. // TODO Util + page
  55. // imagelink Shortcuticon mailto
  56.  
  57.  
  58.  
  59. /**
  60. * Generates the html for a Page. This is the taglib
  61. * <code>
  62. * Usage:
  63. * $page = new Page();
  64. * print $page->getHtml();
  65. * Or:
  66. * Page::display();
  67. * Page::p('Some Paragraph');
  68. * </code>
  69. * @package page
  70. */
  71.  
  72. class Page extends Html {
  73.  
  74. /**
  75. * Constructor
  76. */
  77. function Page() {
  78. $this->Html();
  79. }
  80.  
  81. /**
  82. * Returns the content html for the page
  83. * @return String the complete html
  84. */
  85. function getHtml() {
  86. $html = '';
  87. $html .= "<h1>Welcome to the Page() portlet language</h1>";
  88. return $html;
  89. }
  90.  
  91. /**
  92. * Display all
  93. * <code>
  94. * Usage:
  95. * Page::show();
  96. * </code>
  97. * @static
  98. */
  99. function show() {
  100. DocType::display();
  101. HeadStart::display();
  102. Title::display('My title');
  103. Meta::display('My Meta title','my description','myKeyword','keyword1,keyword2');
  104. //MetaRotator::display();
  105. Css::display();
  106. Javascript::display();
  107. //ShortcutIcon::display();
  108.  
  109. BodyStart::display(); // </head><body>
  110. Noscript::display();
  111. //Line::display();
  112. //Banner::display();
  113. //Bannerif::display();
  114. //TopMenu::display();
  115. //Locator::display();
  116.  
  117. //Skeleton::tablestart();
  118. //Skeleton::rowstart();
  119. //Skeleton::columnstart();
  120.  
  121. //MenuLink::display();
  122. //LeftMenu::display();
  123.  
  124. //Skeleton::columnend();
  125. //Skeleton::columnstart();
  126.  
  127. //ContentArray::display();
  128. //ContentReferer::display();
  129. //ContentRotator::display();
  130. //Contentdate::display();
  131. //ContentXml::display();
  132. //Content::display();
  133.  
  134. //Skeleton::columnstart();
  135.  
  136. //RightMenu::display();
  137.  
  138. //Skeleton::columnend();
  139. //Skeleton::rowend();
  140. //Skeleton::tableend();
  141.  
  142. //BottomMenu::display();
  143. //Footer::display();
  144. //Customer::display();
  145. //Company::display();
  146. //Copyright::display();
  147. BodyEnd::display();
  148. }
  149.  
  150. /**
  151. * Display html
  152. * <code>
  153. * Usage:
  154. * Page::display();
  155. * </code>
  156. * @static
  157. */
  158. function display() {
  159. $html = new Page();
  160. $html->addHtml();
  161. }
  162.  
  163. // ************* HTML tags *************
  164.  
  165.  
  166. /**
  167. * Display start
  168. * <code>
  169. * Usage:
  170. * Page::start('ul'); // Generates a start <ul>
  171. * Page::start('p'); // Generates a start <p>
  172. * </code>
  173. * @static
  174. * @param String $element The html element, Valid elements: p,br,h1..h6,li,b,pre
  175. * @param String $class The css class name
  176. */
  177. function start($element,$class='') {
  178. Text::start($element,$class);
  179. }
  180.  
  181. /**
  182. * Display end
  183. * <code>
  184. * Usage:
  185. * Page::end(); // Generates an end of PAGE
  186. * Page::end('ul'); // Generates an end </ul>
  187. * Page::end('p'); // Generates an end </p>
  188. * </code>
  189. * @static
  190. */
  191. function end($element='') {
  192. Text::end($element);
  193. }
  194.  
  195. /**
  196. * Display li
  197. * <code>
  198. * Usage:
  199. * Page::li($text,$class);
  200. * </code>
  201. * @static
  202. * @param String $text The text to show with <li>$text</li>
  203. * @param String $class The css class name
  204. */
  205. function li($text,$class='') {
  206. Text::display($text,'li',$class);
  207. }
  208.  
  209. /**
  210. * Display p
  211. * <code>
  212. * Usage:
  213. * Page::p($text,$class);
  214. * </code>
  215. * @static
  216. * @param String $text The text to show with <p>$text</p>
  217. * @param String $class The css class name
  218. */
  219. function p($text,$class='') {
  220. Text::display($text,'p',$class);
  221. }
  222.  
  223. /**
  224. * Display h1
  225. * <code>
  226. * Usage:
  227. * Page::h1($text,$class,$name);
  228. * </code>
  229. * @static
  230. * @param String $text The text to show with <h1>$text</h1>
  231. * @param String $class The css class name
  232. * @param String $name The name/id attribute for a link identifier
  233. */
  234. function h1($text,$class='',$name='') {
  235. Text::display($text,'h1',$class,$name);
  236. }
  237. function h2($text,$class='',$name='') {
  238. Text::display($text,'h2',$class,$name);
  239. }
  240. function h3($text,$class='',$name='') {
  241. Text::display($text,'h3',$class,$name);
  242. }
  243. function h4($text,$class='',$name='') {
  244. Text::display($text,'h4',$class,$name);
  245. }
  246. function h5($text,$class='',$name='') {
  247. Text::display($text,'h5',$class,$name);
  248. }
  249. function h6($text,$class='',$name='') {
  250. Text::display($text,'h6',$class,$name);
  251. }
  252.  
  253. /**
  254. * Display br
  255. * <code>
  256. * Usage:
  257. * Page::br();
  258. * </code>
  259. * @static
  260. */
  261. function br() {
  262. Text::end('br');
  263. }
  264.  
  265. /**
  266. * Display hr
  267. * <code>
  268. * Usage:
  269. * Page::hr($class);
  270. * </code>
  271. * @static
  272. * @param String $class The css class name
  273. */
  274. function hr($class='') {
  275. Text::end('hr',$class);
  276. }
  277.  
  278. /**
  279. * Display comment
  280. * <code>
  281. * Usage:
  282. * Page::comment($text);
  283. * </code>
  284. * @static
  285. * @param String $text The text to add as comment
  286. */
  287. function comment($text='') {
  288. Comment::display($text);
  289. }
  290.  
  291. /**
  292. * Display text
  293. * <code>
  294. * Usage:
  295. * Page::text($text,$element,$class);
  296. * </code>
  297. * @static
  298. * @param String $text The text to show with i.e. <p>$text</p>
  299. * @param String $element The html element, if any
  300. * Valid elements: p,br,h1..h6,li,b
  301. * @param String $class The css class name
  302. */
  303. function text($text='',$element='',$class='') {
  304. Text::display($text,$element,$class);
  305. }
  306.  
  307. /**
  308. * Display link
  309. * <code>
  310. * Usage:
  311. * Page::link($text,$href,$class,$title,$aux);
  312. * </code>
  313. * @static
  314. * @param String $text The text for the link
  315. * @param String $href The url for the link
  316. * @param String $class The css class of the link
  317. * @param String $title The tool tip of the link
  318. * @param String $aux Add 'br' or 'li' html Pages, if required
  319. */
  320. function link($text='',$href='',$class='',$title='',$aux='') {
  321. Link::display($text,$href,$class,$title,$aux);
  322. }
  323.  
  324. /**
  325. * Display mailto
  326. * <code>
  327. * Usage:
  328. * Page::mailto($text,$href,$class,$title,$aux);
  329. * </code>
  330. * @static
  331. * @param String $text The text for the link
  332. * @param String $href The url for the link
  333. * @param String $class The css class of the link
  334. * @param String $title The tool tip of the link
  335. * @param String $aux Add 'br' or 'li' html Pages, if required
  336. */
  337. function mailto($text='',$href='',$class='',$title='',$aux='') {
  338. EmailLink::display($text,$href,$class,$title,$aux);
  339. }
  340.  
  341. /**
  342. * Display image
  343. * <code>
  344. * Usage:
  345. * Page::image($src,$width,$height,$alt,$class,$border);
  346. * will insert an image here
  347. * </code>
  348. * @static
  349. * @param String $srct The source path for the image
  350. * @param String $width The width
  351. * @param String $height The height
  352. * @param String $alt The alt text
  353. * @param String $class The css class for the image
  354. * @param String $border The border of an image
  355. */
  356. function image($src='',$width='',$height='',$alt='',$class='',$border='') {
  357. Image::display($src,$width,$height,$alt,$class,$border);
  358. }
  359.  
  360. /**
  361. * Display iframe
  362. * <code>
  363. * Usage:
  364. * Page::iframe($src);
  365. * will insert an iframe here
  366. * </code>
  367. * @static
  368. * @param String $srct The source path for the html to iframe
  369. */
  370. function iframe($src='') {
  371. Iframe::display($src);
  372. }
  373.  
  374. /**
  375. * Display imagelink
  376. * <code>
  377. * Usage:
  378. * Page::imagelink($image, $link);
  379. * </code>
  380. * @static
  381. * @param String $image The image object to show
  382. * @param String $link The link object to go to
  383. */
  384. function imagelink($image='', $link='') {
  385. ImageLink::display($image, $link);
  386. }
  387.  
  388. // ************* COMPONENTS *************
  389.  
  390.  
  391. /**
  392. * Display doctype
  393. * <code>
  394. * Usage:
  395. * Page::doctype($doctype);
  396. * </code>
  397. * @static
  398. * @param String $doctype The doctype to use
  399. */
  400. function doctype($doctype='') {
  401. DocType::display($doctype);
  402. }
  403.  
  404. /**
  405. * Display headstart
  406. * <code>
  407. * Usage:
  408. * Page::headstart();
  409. * </code>
  410. * @static
  411. */
  412. function headstart() {
  413. HeadStart::display();
  414. }
  415.  
  416. /**
  417. * Display title
  418. * <code>
  419. * Usage:
  420. * Page::title($title);
  421. * </code>
  422. * @static
  423. * @param String $title The title of the page
  424. */
  425. function title($title='') {
  426. Title::display($title);
  427. }
  428.  
  429. /**
  430. * Display meta
  431. * <code>
  432. * Usage:
  433. * Page::meta('the title','the description','the keyword','keyword1,keyword2,...');
  434. * </code>
  435. * @static
  436. * @param String $title The title of the page
  437. * @param String $description The description of the page
  438. * @param String $keyword The unique keyword for this page
  439. * @param String $keywords The keywords for the page
  440. */
  441. function meta($title='',$description='',$keyword='',$keywords='') {
  442. Meta::display($title,$description,$keyword,$keywords);
  443. }
  444.  
  445. /**
  446. * Display metarotator
  447. * <code>
  448. * Usage:
  449. * Page::metarotator($group,$keyword,$file);
  450. * </code>
  451. * @static
  452. * @param String $group The Meta group to use
  453. * @param String $keyword The Meta keyword to use
  454. * @param String $file The Meta file to use
  455. */
  456. function metarotator($group='',$keyword='',$file='') {
  457. MetaRotator::display($group,$keyword,$file);
  458. }
  459.  
  460. /**
  461. * Display css
  462. * <code>
  463. * Usage:
  464. * Page::css($href);
  465. * </code>
  466. * @static
  467. * @param String $href The url to the css file (i.e. /css/my.css)
  468. */
  469. function css($href='') {
  470. CssBase::display($href);
  471. }
  472.  
  473. /**
  474. * Display javascript
  475. * <code>
  476. * Usage:
  477. * Page::javascript($href);
  478. * </code>
  479. * @static
  480. * @param String $href The url to the Javascript file (i.e. /include/my.js)
  481. */
  482. function javascript($href='') {
  483. Javascript::display($href);
  484. }
  485.  
  486. /**
  487. * Display shortcuticon
  488. * <code>
  489. * Usage:
  490. * Page::shortcuticon($href);
  491. * </code>
  492. * @static
  493. * @param String $href The url to the Shortcut Icon
  494. */
  495. function shortcuticon($href='') {
  496. ShortcutIcon::display($href);
  497. }
  498.  
  499. /**
  500. * Display bodystart
  501. * <code>
  502. * Usage:
  503. * Page::bodystart();
  504. * </code>
  505. * @static
  506. */
  507. function bodystart() {
  508. BodyStart::display();
  509. }
  510.  
  511. /**
  512. * Display noscript
  513. * <code>
  514. * Usage:
  515. * Page::noscript();
  516. * </code>
  517. * @static
  518. */
  519. function noscript() {
  520. Noscript::display();
  521. }
  522.  
  523. /**
  524. * Display line
  525. * <code>
  526. * Usage:
  527. * Page::line($width,$height,$class);
  528. * </code>
  529. * @static
  530. * @param String $width The width of the table
  531. * @param String $height The height of the line
  532. * @param String $class The css class to use
  533. * @param String $border The table border
  534. * @param String $cellPadding
  535. * @param String $cellSpacing
  536. */
  537. function line($width='',$height='',$class='',$border='',$cellPadding='',$cellSpacing='') {
  538. Line::display($width,$height,$class,$border,$cellPadding,$cellSpacing);
  539. }
  540.  
  541. /**
  542. * Display banner
  543. * <code>
  544. * Usage:
  545. * Page::banner($width,$link,$imagelink);
  546. * </code>
  547. * @static
  548. * @param String $width The width of the table
  549. * @param String $link_id The link object to use
  550. * @param String $imagelink_id The imagelink object to use
  551. */
  552. function banner($width='',$link='',$imagelink='') {
  553. Banner::display($width,$link,$imagelink);
  554. }
  555.  
  556. /**
  557. * Display bannerif
  558. * <code>
  559. * Usage:
  560. * Page::bannerif($width);
  561. * </code>
  562. * @static
  563. * @param String $width The width of the table
  564. */
  565. function bannerif($width='') {
  566. Bannerif::display($width);
  567. }
  568.  
  569. /**
  570. * Display locator
  571. * <code>
  572. * Usage:
  573. * Page::locator($width,$class);
  574. * </code>
  575. * @static
  576. * @param String $width The width of the table
  577. * @param String $class The css class of the table
  578. */
  579. function locator($width='',$class='') {
  580. Locator::display($width,$class);
  581. }
  582.  
  583. /**
  584. * Display googlestart
  585. * <code>
  586. * Usage:
  587. * Page::googlestart();
  588. * </code>
  589. * @static
  590. */
  591. function googlestart() {
  592. Google::start();
  593. }
  594.  
  595. /**
  596. * Display google
  597. * <code>
  598. * Usage:
  599. * Page::google($text);
  600. * </code>
  601. * @static
  602. * @param String $tex, The default search pattern
  603. */
  604. function google($text='') {
  605. Google::display($text);
  606. }
  607.  
  608. /**
  609. * Display googleend
  610. * <code>
  611. * Usage:
  612. * Page::googleend();
  613. * </code>
  614. * @static
  615. */
  616. function googleend() {
  617. Google::end();
  618. }
  619.  
  620. /**
  621. * Display topmenu
  622. * <code>
  623. * Usage:
  624. * Page::topmenu($links,$text,$width,$class);
  625. * </code>
  626. * @static
  627. * @param String $links An array of links
  628. * @param String $text, The text above the menu links
  629. * @param String $width The width of the menu
  630. * @param String $class The css class for the menu
  631. */
  632. function topmenu($links='',$text='',$width='',$class='') {
  633. TopMenu::display($links,$text,$width,$class);
  634. }
  635.  
  636. /**
  637. * Display menulink
  638. * <code>
  639. * Usage:
  640. * Page::menulink($path);
  641. * </code>
  642. * @static
  643. * @param String $path The directory path to start from
  644. */
  645. function menulink($path='') {
  646. MenuLink::display($path);
  647. }
  648.  
  649. /**
  650. * Display leftmenu
  651. * <code>
  652. * Usage:
  653. * Page::leftmenu($links,$text,$width,$class);
  654. * </code>
  655. * @static
  656. * @param String $links an array of links
  657. * @param String $text The text above the menu links
  658. * @param String $width The width of the menu
  659. * @param String $class The css class for the menu
  660. */
  661. function leftmenu($links='',$text='',$width='',$class='') {
  662. LeftMenu::display($links,$text,$width,$class);
  663. }
  664.  
  665. /**
  666. * Display rightmenu
  667. * <code>
  668. * Usage:
  669. * Page::rightmenu($links,$text,$width,$class);
  670. * </code>
  671. * @static
  672. * @param String $links an array of links
  673. * @param String $text The text above the menu links
  674. * @param String $width The width of the menu
  675. * @param String $class The css class for the menu
  676. */
  677. function rightmenu($links='',$text='',$width='',$class='') {
  678. RightMenu::display($links,$text,$width,$class);
  679. }
  680.  
  681. /**
  682. * Display bottommenu
  683. * <code>
  684. * Usage:
  685. * Page::bottommenu($links,$text,$width,$class);
  686. * </code>
  687. * @static
  688. * @param String $links An array of links
  689. * @param String $text The text above the menu links
  690. * @param String $width The width of the menu
  691. * @param String $class The css class for the menu
  692. */
  693. function bottommenu($links='',$text='',$width='',$class='') {
  694. BottomMenu::display($links,$text,$width,$class);
  695. }
  696.  
  697. /**
  698. * Display copyright
  699. * <code>
  700. * Usage:
  701. * Page::copyright($width);
  702. * </code>
  703. * @static
  704. * @param String $width The width of the table, default 100%
  705. */
  706. function copyright($width='') {
  707. Copyright::display($width);
  708. }
  709.  
  710. /**
  711. * Display customer
  712. * <code>
  713. * Usage:
  714. * Page::customer($text,$width);
  715. * </code>
  716. * @static
  717. * @param String $text The text of the table
  718. * @param String $width The width of the table, default 100%
  719. */
  720. function customer($text='',$width='',$class='',$border='',$cellPadding='',$cellSpacing='') {
  721. Customer::display($text,$width,$class,$border,$cellPadding,$cellSpacing);
  722. }
  723.  
  724. /**
  725. * Display company
  726. * <code>
  727. * Usage:
  728. * Page::company($text,$width);
  729. * </code>
  730. * @static
  731. * @param String $text The text of the table
  732. * @param String $width The width of the table, default 100%
  733. */
  734. function company($text='',$width='',$class='',$border='',$cellPadding='',$cellSpacing='') {
  735. Company::display($text,$width,$class,$border,$cellPadding,$cellSpacing);
  736. }
  737.  
  738. /**
  739. * Display imagerotator
  740. * <code>
  741. * Usage:
  742. * Page::imagerotator($path);
  743. * </code>
  744. * @static
  745. * @param String $path The path to the images to rotate
  746. */
  747. function imagerotator($path='') {
  748. Imagerotator::display($path);
  749. }
  750.  
  751. /**
  752. * Display footer
  753. * <code>
  754. * Usage:
  755. * Page::footer($width);
  756. * </code>
  757. * @static
  758. * @param String $width The width of the table, default 100%
  759. */
  760. function footer($width='') {
  761. Footer::display($width);
  762. }
  763.  
  764. /**
  765. * Display bodyend
  766. * <code>
  767. * Usage:
  768. * Page::bodyend();
  769. * </code>
  770. * @static
  771. */
  772. function bodyend() {
  773. BodyEnd::display();
  774. }
  775. }
  776. ?>

Documentation generated on Thu, 22 Dec 2005 17:15:23 +0100 by phpDocumentor 1.3.0RC3