Displaying Archives and Categories
Hi, MoOose here again...
I am now trying to pull the Archives and Categories and have taken and edited the following code from /fuel/blog/modules/blog/views/theme/default/_blocks/
Again this works fine in the Home and Blog pages but as soon as I go to my other pages then they break
I get the following Error message on these pages
Severity: Notice
Message: Undefined variable: CI
Filename: _blocks/footer.php
I do have $CI =& get_instance(); declared in global.php...
your assistance is greatly appreciated by this noOob =}
Archives
<?php $archives_by_month = $CI->fuel_blog->get_post_archives(); ?>
<?php if (!empty($archives_by_month)) : ?>
<?php endif; ?>
Categories
<?php $posts_to_categories = $CI->fuel_blog->get_posts_to_categories(); ?>
<?php if (!empty($posts_to_categories)) : ?>
<?php endif; ?>
Comments
$vars['CI'] =& get_instance();
Or, you could also declare $CI directly in the footer block.
$CI =& get_instance();
fuel_blog->url($month); ?>"><?php echo $month_str; ?>
Completed code below for reference
Archives
<?php$CI =& get_instance();
$archives_by_month = $CI->fuel_blog->get_post_archives();
if (!empty($archives_by_month)) : ?>
- fuel_blog->url($month); ?>"><?php echo $month_str; ?>
<?php endforeach; ?>
<?php endif; ?><?php foreach($archives_by_month as $month => $archives) : $month_str = date('F Y', strtotime(str_replace('/', '-', $month).'-01')); ?>
Categories
<?php $posts_to_categories = $CI->fuel_blog->get_posts_to_categories(); ?><?php if (!empty($posts_to_categories)) : ?>
- category_url; ?>"><?php echo $post_to_category->category_name; ?>
<?php endforeach; ?>
<?php endif; ?><?php foreach($posts_to_categories as $post_to_category) : ?>
Thanks again for all your help,
muchas gracias mi amigo =}