mirror of https://github.com/xfarrow/phpxpress.git
first Card commit
This commit is contained in:
parent
4bacdff0de
commit
cca8b678d5
|
@ -0,0 +1,24 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Table example</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
include "../phpxpress/card.php";
|
||||
|
||||
$card1 = new Card;
|
||||
$card1->setImageSource("colosseum.jpg");
|
||||
$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.");
|
||||
$card1->draw();
|
||||
|
||||
$card2 = new Card;
|
||||
$card2->setImageSource("paris.jpg");
|
||||
$card2->setTitle("Paris");
|
||||
$card2->setSubTitle("Capital of France");
|
||||
$card2->setInnerText("The Parisii, a sub-tribe of the Celtic Senones, inhabited the Paris area from around the middle of the 3rd century BC.");
|
||||
$card2->draw();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
After Width: | Height: | Size: 152 KiB |
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
include "include.php";
|
||||
|
||||
class Card{
|
||||
private $imageSource;
|
||||
private $title;
|
||||
private $subtitle;
|
||||
private $innerText;
|
||||
private $width = 18;
|
||||
|
||||
function setImageSource($imageSource){
|
||||
if(!is_string($imageSource))
|
||||
throw new InvalidArgumentException('Parameter imageSource must be a string.');
|
||||
|
||||
$this->imageSource = $imageSource;
|
||||
}
|
||||
|
||||
function setTitle($title){
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
function setSubTitle($subTitle){
|
||||
$this->subtitle = $subTitle;
|
||||
}
|
||||
|
||||
function setInnerText($innerText){
|
||||
$this->innerText = $innerText;
|
||||
}
|
||||
|
||||
function setWidth($width){
|
||||
$this->width = $width;
|
||||
}
|
||||
|
||||
function draw(){
|
||||
echo '<div class="card" style="width: '.$this->width.'rem;">';
|
||||
|
||||
// Image
|
||||
if(isset($this->imageSource)){
|
||||
echo '<img class="card-img-top" src="'.$this->imageSource.'" alt="Card image cap">';
|
||||
}
|
||||
|
||||
echo '<div class="card-body">';
|
||||
echo '<h5 class="card-title">'. $this->title .'</h5>'; // title
|
||||
echo '<h6 class="card-subtitle mb-2 text-muted">'. $this->subtitle .'</h6>'; // subtitle
|
||||
echo '<p class="card-text">'. $this->innerText . '</p>';
|
||||
echo '</div></div>';
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
include "include.php";
|
||||
class Carousel{
|
||||
|
||||
}
|
||||
?>
|
|
@ -1,5 +1,5 @@
|
|||
<style>
|
||||
<?php
|
||||
include '../bootstrap-5.1.3-dist/css/bootstrap.min.css';
|
||||
include_once '../bootstrap-5.1.3-dist/css/bootstrap.min.css';
|
||||
?>
|
||||
</style>
|
Loading…
Reference in New Issue