<?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/fr/my-page.inc.php
define("MY_PAGE_TITLE", "Titre de ma page"); define("MY_PAGE_DESCRIPTION", "Description de ma page"); define("MY_PAGE_KEYWORDS", "keyword 1,keyword 2,keyword 3,keyword 4"); define("MY_BOX", "Ma boite"); define("HELLOWORLD", "HelloWorld"); ?>
Télécharger l'exemple URL pour tester l'exemple: http://localhost/votre_site_web/my-page .html Voir le rendu de cet exemple (DialogBox) Voir le rendu de cet exemple (Nouvelle page)
|