2022-02-26 01:34:21 +01:00
< html >
< head >
2022-07-19 08:22:20 +02:00
< link rel = " stylesheet " href = " ../bootstrap-5.1.3-dist/css/bootstrap.min.css " >
2022-02-28 13:01:03 +01:00
< title > Card example </ title >
2022-02-26 01:34:21 +01:00
</ head >
< body >
< ? php
2022-07-24 11:10:43 +02:00
include " ../phpxpress/Card.php " ;
2022-02-26 01:34:21 +01:00
2022-07-24 11:10:43 +02:00
PhpXpress\Card :: beginCardGroupLayout ( 36 );
2022-02-26 17:31:18 +01:00
2022-02-28 13:01:03 +01:00
// Rome
2022-07-24 11:10:43 +02:00
$card1 = new PhpXpress\Card ;
2022-03-09 11:01:24 +01:00
$card1 -> setImageSource ( " ./images/colosseum.jpg " );
2022-02-26 01:34:21 +01:00
$card1 -> setTitle ( " Rome " );
$card1 -> setSubTitle ( " Capital of Italy " );
$card1 -> setInnerText ( " After the foundation by Romulus according to a legend, Rome was ruled for a period of 244 years by a monarchical system, initially with sovereigns of Latin and Sabine origin, later by Etruscan kings. " );
2022-02-26 17:31:18 +01:00
$card1 -> setFooterText ( " Image By John " );
$card1 -> addField ( " Mayor " , " Roberto Gualtieri " );
$card1 -> addField ( " Inhabitants " , " 2.763.804 " );
$card1 -> AddField ( " Zip " , " 001XX " );
$card1 -> setButton ( " More info " , " https://en.wikipedia.org/wiki/Rome " );
2022-02-28 13:01:03 +01:00
$card1 -> addLink ( " Town " , " https://www.comune.roma.it/web/it/welcome.page " );
$card1 -> addLink ( " ATAC " , " https://www.atac.roma.it/ " );
2022-02-26 01:34:21 +01:00
$card1 -> draw ();
2022-02-28 13:01:03 +01:00
// Paris
2022-02-26 17:31:18 +01:00
class City {
public $Mayor ;
public $Inhabitants ;
public $Zip ;
}
$paris = new City ;
$paris -> Mayor = " Anne Hidalgo " ;
$paris -> Inhabitants = " 2.229.095 " ;
$paris -> Zip = " 750XX " ;
2022-07-24 11:10:43 +02:00
$card2 = new PhpXpress\Card ;
2022-03-09 11:01:24 +01:00
$card2 -> setImageSource ( " ./images/paris.jpg " );
2022-02-26 01:34:21 +01:00
$card2 -> setTitle ( " Paris " );
$card2 -> setSubTitle ( " Capital of France " );
2022-02-26 17:31:18 +01:00
$card2 -> setInnerText ( " The following fields' name & data will be acquired by the datasource. " );
$card2 -> setDataSource ( $paris );
$card2 -> setButton ( " More info " , " https://en.wikipedia.org/wiki/Paris " );
2022-03-09 11:01:24 +01:00
$card2 -> addArrayToList ( array ( " this is " , " just a list " ));
$card2 -> addElementToList ( " of various sentences " );
2022-02-28 13:01:03 +01:00
$card2 -> addLink ( " Link1 " , " # " );
$card2 -> addLink ( " Link2 " , " # " );
2022-03-09 12:10:56 +01:00
$card2 -> onFieldDisplaying ( " onFieldDisplaying " );
2022-02-26 01:34:21 +01:00
$card2 -> draw ();
2022-02-26 17:31:18 +01:00
2022-07-24 11:10:43 +02:00
PhpXpress\Card :: endCardGroupLayout ();
2022-03-09 12:10:56 +01:00
function onFieldDisplaying ( & $field , & $value ){
if ( $field == " Inhabitants " ){
$value .= " (census 2019) " ;
}
}
2022-02-26 01:34:21 +01:00
?>
</ body >
2022-07-24 11:10:43 +02:00
</ html >