finish up some layout stuff

This commit is contained in:
John Bintz 2009-07-23 18:25:02 -04:00
parent fbec175cb8
commit aeb0adcaaf
6 changed files with 27 additions and 18 deletions

View File

@ -413,6 +413,7 @@ class ComicPressAddonCore extends ComicPressAddon {
break;
case 'comic_space':
case 'category_page_usage':
case 'layout';
$this->comicpress->comicpress_options[$option] = $_POST['cp'][$option];
break;
}
@ -443,10 +444,13 @@ class ComicPressAddonCore extends ComicPressAddon {
}
}
/**
* Create the dropdown for choosing a layout.
*/
function create_layout_options($layouts, $current_layout) {
$output = array();
foreach ($layouts as $layout_filename => $name) {
$output[] = '<option value="' . $layout_filename . '"' . (($layout_filename == $current_layout) ? ' selected="selected"' : '') . '>' . $name . '</option>';
foreach ($layouts as $layout_filename => $info) {
$output[] = '<option value="' . $layout_filename . '"' . (($layout_filename == $current_layout) ? ' selected="selected"' : '') . '>' . $info['Layout Name'] . '</option>';
}
return implode("\n", $output);
}

View File

@ -48,6 +48,16 @@ function __comicpress_init() {
}
}
}
$layouts = $comicpress->get_layout_choices();
if (isset($layouts[$comicpress->comicpress_options['layout']])) {
if (isset($layouts[$comicpress->comicpress_options['layout']]['Sidebars'])) {
foreach (explode(",", $layouts[$comicpress->comicpress_options['layout']]['Sidebars']) as $sidebar) {
$sidebar = trim($sidebar);
register_sidebar($sidebar);
}
}
}
}
function comicpress_init() {
@ -77,7 +87,7 @@ function comicpress_get_header() {
}
function include_partial($partials = '') {
global $comicpress;
global $comicpress, $post, $nav_comics;
if (!is_array($partials)) {
$partials = func_get_args();

View File

@ -1,11 +1,12 @@
<?php
global $comicpress;
global $comicpress, $post, $nav_comics;
comicpress_init();
$nav_comics = $comicpress->get_nav_comics();
$t = $post;
$post = $nav_comics['last'];
setup_postdata($post);
ob_start();
@ -20,11 +21,12 @@
include_partial('index-blog-header');
foreach ($comicpress->get_index_blog_posts() as $post) {
setup_postdata($post);
include_partial('index-blog-post');
}
$content = ob_get_clean();
$post = $t;
include(get_template_directory() . '/layouts/classic.inc');
include(get_template_directory() . '/layouts/' . $comicpress->comicpress_options['layout']);
?>

View File

@ -1,12 +1,9 @@
<?php
/*
Layout Name: Classic
Sidebars: right
*/
if (function_exists('register_sidebar')) {
register_sidebar('right');
}
?>
<?php get_header() ?>

View File

@ -1,13 +1,9 @@
<?php
/*
Layout Name: Classic
Layout Name: Three Column
Sidebars: left,right
*/
if (function_exists('register_sidebar')) {
register_sidebar('left');
register_sidebar('right');
}
?>
<?php get_header() ?>

View File

@ -2,7 +2,7 @@
<div class="post-comic">
<?php include('nav.inc') ?>
<div class="comicdate">
<?php the_date('F jS, Y') ?>
<?php echo mysql2date('F jS, Y', $post->post_date) ?>
</div>
<div class="clear"></div>
<?php if (get_option('comicpress-enable-storyline-support') == 1) { ?>