Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Column {
- function Column($span, $size) {
- // Makes you even lazier by returning Bootstrap column length and size for style attr
- $span_options = array( 1 => "1", 2 => "2", 3 => "3", 4 => "4",
- 5 => "5", 6 => "6", 7 => "7", 8 => "8",
- 9 => "9", 10 => "10", 11 => "11", 12 => "12"
- );
- $size_options = array("xs", "sm", "md", "lg");
- $size_options_mapping = array(0,1,2,3);
- $a = in_array($span, $span_options);
- $b = in_array($size, $size_options_mapping);
- if ( $a and $b ) {
- $this->size = $size_options[$size];
- $this->span = $span_options[$span];
- } else {
- trigger_error(" First parameter is the bootstrap column length (int 0 - 12). \n
- Second parameter is the bootstrap column size (xs, sm, md, lg). ", E_USER_ERROR);
- }
- }
- function style() {
- if ( isset($this->span) && isset($this->size) ) {
- echo "col-". $this->size . "-" . $this->span;
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement