-
Notifications
You must be signed in to change notification settings - Fork 0
/
card.php
105 lines (84 loc) · 1.89 KB
/
card.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/*DOCUMENTATION
Personal Website Cards - Material Design
Created on 17th Sep 15, 2:20pm
(c)2015 Aravind Balaji
USAGE:
1. Create an Object of type CARD
2. Set Card css properties [eg. color,height,width etc]
3. Call 'create' function to apply properties and create Card
EXAMPLE:
$card = new Card(); ----------Creating object
$card->setTitleColor("Black");---------Setting Card properties
$card->setBodyColor("#424E42");------------"-----"-----------
$card->create("About","30%");----------Creating and applying Card
*/
class Card
{
private $width = "30%";
private $height = "";
private $card_title_color = "";
private $card_body_color = "";
private $title_textcolor="";
private $body_textcolor="";
function create($title,$body,$width,$height='')
{
$this->width = $width;
$this->height = $height;
echo "
<div id='card_box'>
<div id='card_title'>
<span>$title</span>
</div>
<div id='card_body'>
$body
</div>
</div>
";
$this->apply();
}
function TitleColor($card_title_color)
{
$this->card_title_color = $card_title_color;
}
function BodyColor($card_body_color)
{
$this->card_body_color = $card_body_color;
}
function Body_TextColor($body_textcolor)
{
$this->body_textcolor = $body_textcolor;
}
function Title_TextColor($title_textcolor)
{
$this->title_textcolor = $title_textcolor;
}
function apply()
{
echo "<style>
#card_box
{
border-radius: 3%;
margin-left: 0.5%;
margin-top: -0.5%;
box-shadow: 0px 0px 10px Gray;
height: $this->height;
width: $this->width;
}
#card_title
{
border-radius: 3% 3% 0% 0%;
padding: 2%;
background:$this->card_title_color;
color:$this->title_textcolor;
}
#card_body
{ padding: 2%;
border-radius: 0% 0% 3% 3%;
background: $this->card_body_color;
color:$this->body_textcolor;
}
</style>";
}
}//Class Ends
?>