<?php /** * PHP file pages\my-page.php */ /** * Page my-page * URL: http://127.0.0.1/website-php/my-page.html * * WebSite-PHP : PHP Framework 100% object (http://www.website-php.com) * Copyright (c) 2009-2020 WebSite-PHP.com * PHP versions >= 5.2 * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @author Emilien MOREL <admin@website-php.com> * @link http://www.website-php.com * @copyright WebSite-PHP.com 22/04/2020 * @version 1.3.1 * @access public * @since 1.0.18 */
// MyPage is a class which extends Page Object class MyPage extends Page { // First called method to instanciate page object public function InitializeComponent() { // create a new object Box $my_box = new Box(__(MY_BOX), true); $my_box->setWidth(300); // set the with size of the box // create a new object Label (text) // __(): call the translation of HELLOWORLD $my_label = new Label(__(HELLOWORLD)); // set label to the content of the box $my_box->setContent($my_label); // associate my main object (my_box) to the render of the page $this->render = $my_box; } // Load method public function Load() { // Page title // __(): call the translation of MY_PAGE_TITLE parent::$PAGE_TITLE = __(MY_PAGE_TITLE); // Page description // __(): call the translation of MY_PAGE_DESCRIPTION parent::$PAGE_DESCRIPTION = __(MY_PAGE_DESCRIPTION); // Page meta tag keywords // __(): call the translation of MY_PAGE_KEYWORDS parent::$PAGE_KEYWORDS = __(MY_PAGE_KEYWORDS); } } ?>
<?php // File : lang/de/my-page.inc.php
define("MY_PAGE_TITLE", "Mein Seitentitel"); define("MY_PAGE_DESCRIPTION", "Meine Seitenbeschreibung"); define("MY_PAGE_KEYWORDS", "Schlüsselwort 1, Schlüsselwort 2, Schlüsselwort 3, Schlüsselwort 4"); define("MY_BOX", "Meine Box"); define("HELLOWORLD", "HelloWorld"); ?>
Beispiel herunterladen URL um dieses Beispiel zu testen: http://localhost/votre_site_web/my-page .html Zeige das Ergebnis dieses Beispiels (DialogBox) Zeige das Ergebnis dieses Beispiels (Neue Seite)
|