function show_top_content($type = 'default', $source) { if ($type == 'slide-show' && function_exists('putRevSlider')) { // Get slide show information $content = explode(':', $source); $sliderAlias = apply_filters('header-slide-show', $content[1]); $sectionClass = 'rev_slider-' . $sliderAlias; // Slide show putRevSlider($sliderAlias); } else { // Default Header (title and breadcrumbs) ?> <div class="inner-wrapper"> <?php if ($type != 'default') { if ($type == 'static-block') { $type = 'static_block'; } $content = explode('@', $source); echo get_layout_content_block($type, $content[1]); /* // NO DEFAULT, Default is empty. else : ?> <!-- default content --> <?php */ } // $type != 'default' ?> </div> <?php } // $type == 'slideshow' }
function generate_content_layout($position = 'start', $layout = false, $context = false) { global $layouts_manager, $has_layout; // Make sure some layout information was found //................................................................ // get_layout_options('layout', 'layout-1374843373'); // Final check before we start outputting the layout if (!isset($layout) || empty($layout)) { // No layout information was found return false; } else { $alias = $layout['alias']; // Begin displaying the layout //................................................................ // This variable is used to determine the start/stop position between // the header and footer display of the layout $contentBreak = false; if (is_array($layout['body_structure'])) { // Do we print the information yet? $output = false; if ($position == 'start' && !$contentBreak) { $output = true; // the header/start of the layout BEFORE the content break is reached } elseif ($position == 'end' && $contentBreak) { $output = true; // the footer/end of the layout AFTER the content break is reached } // loop through the rows if (IS_CHILD && isset($layouts_manager->layouts_manager_options['settings'])) { $grid_type = false === strstr($layouts_manager->layouts_manager_options['settings']['column-class-format'], '%') ? 'fixed' : 'fluid'; // for unsemantic if ($grid_type == 'fluid') { $column_fluid_width = 100 / $layouts_manager->layouts_manager_options['settings']['columns']; } } else { $grid_type = 'fixed'; } $rows = $layout['body_structure']; $row_count = 1; $row_id = 'id="' . $alias . '_row_' . $row_count . '"'; $layout_name = 'layout_' . sanitize_title($layouts_manager->layouts_manager_options['layouts'][$alias]['title']); $row_class = IS_CHILD && isset($layouts_manager->layouts_manager_options['settings']) ? $layouts_manager->layouts_manager_options['settings']['row-class'] : 'row-fluid'; //if ($output) echo '<div '. $row_id .' class="page-width">' . PHP_EOL; // with line break if ($output) { echo '<div id="' . $layout_name . '" class="grid-wrapper">' . PHP_EOL; } // with line break foreach ((array) $rows as $columns) { //if ($output) echo '<div '. $row_id .' class="row">' . PHP_EOL; // with line break if ($output) { echo '<section class="grid-section-' . $row_count . '">' . '<div class="grid-row ' . $row_class . '">' . PHP_EOL; } // with line break // loop through the columns in each container $column_count = 1; $grid_used = 0; // this tracks the previous column widths foreach ((array) $columns as $column) { // Set the visible combo tags for responsive layouts $visible = ''; $visible_on = ''; if (isset($column['visible_on'])) { // Select the correct class switch ($visible_on) { case 'P': // Phone only $visible = ' visible-phone'; break; case 'T': // Tablet only $visible = ' visible-tablet'; break; case 'D': // Desktop only $visible = ' visible-desktop'; break; case 'TD': // Tablet and Desktop $visible = ' hidden-phone'; break; case 'PD': // Phone and Desktop $visible = ' hidden-tablet'; break; case 'PT': // Phone and Tablet $visible = ' hidden-desktop'; break; default: // Nothing to set. // If nothing is selected as visible... assume the user screwed up? break; } foreach ((array) $column['visible_on'] as $device) { if ($device == 'phone') { $visible_on .= "P"; } // P for Phone if ($device == 'tablet') { $visible_on .= "T"; } // T for Tablet if ($device == 'desktop') { $visible_on .= "D"; } // D for Desktop } } // The position set in the layout $gridPosition = isset($column['grid_position']) ? $column['grid_position'] : $layouts_manager->layouts_manager_options['settings']['columns']; $gridPosition = $grid_type == 'fixed' ? $gridPosition : $gridPosition * $column_fluid_width; // Set the style and class variables $size = $grid_type == 'fixed' ? $gridPosition - $grid_used : intval($gridPosition - $grid_used); //$col_class = 'span'.$size.' column-'.$column_count.' '.$visible; if (IS_CHILD && isset($layouts_manager->layouts_manager_options['settings'])) { $column_class_format = $grid_type == 'fixed' ? str_replace('#', '', $layouts_manager->layouts_manager_options['settings']['column-class-format']) . $size : str_replace('%', '', $layouts_manager->layouts_manager_options['settings']['column-class-format']) . $size; } else { $column_class_format = 'span' . $size; } // Output the container //if ($output) echo '<div class="'.$col_class.'">' . PHP_EOL; // with line break if ($output) { echo '<div class="grid-column-' . $column_count . ' ' . $column_class_format . '">' . PHP_EOL; } // with line break // loop through the content elements in each column $element_count = 1; foreach ((array) $column['content_elements'] as $content) { $block_class = 'content-element-' . $element_count; if ($output) { echo '<div class="' . $block_class . '">' . PHP_EOL; // with line break echo get_layout_content_block($content['content_type'], $content['content_source']); } // Record when 'default_content' is reached for the first time if (!$contentBreak && $content['content_type'] == 'default_content') { // This is the first "default_content" (there should only be one, but people can get confused...) $contentBreak = true; // record that we reached the break if ($position == 'start') { $output = false; // don't output anymore in the 'start' section break 3; // break out of layout loop entirely, no more to do in 'start' } elseif ($position == 'end') { // This is where we start outputting the 'end' section $output = true; } } if ($output) { echo '</div> <!-- / .' . $block_class . ' -->' . PHP_EOL; } // with line break $element_count++; } // END foreach $column['content_elements'] //if ($output) echo '</div> <!-- / .'. $col_class .' -->' . PHP_EOL; // with line break if ($output) { echo '</div> <!-- / .' . $column_class_format . ' -->' . PHP_EOL; } // with line break $grid_used += $size; // Update the used portion of the row. $column_count++; } // END foreach $columns //if ($output) echo '</div> <!-- / #'. $row_id .' -->' . PHP_EOL; // with line break if ($output) { echo '</div> <!-- / #' . $row_class . ' -->' . PHP_EOL; } // with line break if ($output) { echo '</section> <!-- section - ' . $row_count . ' -->' . PHP_EOL; } // with line break $row_count++; } // END foreach $rows //if ($output) echo '</div> <!-- page-width -->' . PHP_EOL; // with line break // if ($output) echo '</section> <!-- section -->' . PHP_EOL; // with line break if ($output) { echo '</div> <!-- grid-wrapper -->' . PHP_EOL; } // with line break } } }