Skip to content

Commit

Permalink
Adding an alternative media idx disp to load elements by category
Browse files Browse the repository at this point in the history
Reverting previous changes
  • Loading branch information
mgsolipa committed Oct 30, 2015
1 parent 3b1da50 commit f7304da
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 73 deletions.
120 changes: 120 additions & 0 deletions skins/photoblog/_mediaidx.disp.php
@@ -0,0 +1,120 @@
<?php
/**
* This is the template that displays the media index for a blog
*
* This file is not meant to be called directly.
* It is meant to be called by an include in the main.page.php template.
* To display the archive directory, you should call a stub AND pass the right parameters
* For example: /blogs/index.php?disp=arcdir
*
* b2evolution - {@link http://b2evolution.net/}
* Released under GNU GPL License - {@link http://b2evolution.net/about/gnu-gpl-license}
* @copyright (c)2003-2015 by Francois Planque - {@link http://fplanque.com/}
*
* @package evoskins
*/
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );

global $thumbnail_sizes;

if( ! $cat = param( $Skin->get_setting( 'alt_idx_varname' ) ) )
{
if( empty( $params ) )
{ // Initialize array with params
$params = array();
}

// Merge the params from current skin
$params = array_merge( array(
'mediaidx_thumb_size' => 'fit-80x80'
), $params );

$photocell_styles = '';
if( isset( $thumbnail_sizes[ $params['mediaidx_thumb_size'] ] ) )
{
$photocell_styles = ' style="width:'.$thumbnail_sizes[ $params['mediaidx_thumb_size'] ][1].'px;'
.'height:'.$thumbnail_sizes[ $params['mediaidx_thumb_size'] ][2].'px"';
}

// --------------------------------- START OF MEDIA INDEX --------------------------------
skin_widget( array(
// CODE for the widget:
'widget' => 'coll_media_index',
// Optional display params
'block_start' => '',
'block_end' => '',
'block_display_title' => false,
'thumb_size' => $params['mediaidx_thumb_size'],
'thumb_layout' => 'grid',
'grid_start' => '<div class="image_index">',
'grid_end' => '</div>',
'grid_nb_cols' => 8,
'grid_colstart' => '',
'grid_colend' => '',
'grid_cellstart' => '<div><span'.$photocell_styles.'>',
'grid_cellend' => '</span></div>',
'order_by' => $Blog->get_setting('orderby'),
'order_dir' => $Blog->get_setting('orderdir'),
'limit' => 1000,
) );
// ---------------------------------- END OF MEDIA INDEX ---------------------------------
}
else
{
global $MainList;
global $BlogCache, $Blog;
global $Item, $Settings;

$listBlog = $Blog;

//load_class( 'items/model/_itemlistlight.class.php', 'ItemListLight' );
$ItemList = new ItemList2( $listBlog, $listBlog->get_timestamp_min(), $listBlog->get_timestamp_max(), 100, 'ItemCache' );

$filters = array('cat_array' => array($cat));
$ItemList->set_filters( $filters, false );
// Run the query:
$ItemList->query();

while( $Item = & $ItemList->get_item() )
{
// Default params:
$params = array_merge( array(
'feature_block' => false,
'item_class' => 'bPost',
'item_status_class' => 'bPost',
'content_mode' => 'full', // We want regular "full" content, even in category browsing: i-e no excerpt or thumbnail
'image_size' => '', // Do not display images in content block - Image is handled separately
'url_link_text_template' => '', // link will be displayed (except player if podcast)
), $params );
?>

<div id="<?php $Item->anchor_id() ?>" class="<?php $Item->div_classes( $params ) ?>" lang="<?php $Item->lang() ?>">

<?php
$Item->locale_temp_switch(); // Temporarily switch to post locale (useful for multilingual blogs)
?>

<?php
// Display images that are linked to this post:
$Item->images( array(
'before' => '<div class="bImages">',
'before_image' => '<div class="image_block" style="display: inline-block">',
'before_image_legend' => '<div class="image_legend">',
'after_image_legend' => '</div>',
'after_image' => '</div>',
'after' => '</div>',
'image_size' => 'fit-80x80',
'restrict_to_image_position' => 'cover,teaser,teaserperm,teaserlink,aftermore',
) );

?>
<h3 class="bTitle linked"><?php $Item->title( array('link_type' => 'permalink') ); ?></h3>
<?php

locale_restore_previous(); // Restore previous locale (Blog locale)
?>

</div>
<?php
}
}
56 changes: 0 additions & 56 deletions skins/photoblog/_posts_media_index.inc.php

This file was deleted.

5 changes: 5 additions & 0 deletions skins/photoblog/_skin.class.php
Expand Up @@ -49,6 +49,11 @@ function get_param_definitions( $params )
load_funcs( 'files/model/_image.funcs.php' );

$r = array_merge( array(
'alt_idx_varname' => array(
'label' => T_('Name of the parameter expected to load alternative media index'),
'defaultvalue' => 'jl_main_cat',
'type' => 'text',
),
'menu_bg_color' => array(
'label' => T_('Menu background color'),
'note' => T_('E-g: #0000ff for blue'),
Expand Down
18 changes: 1 addition & 17 deletions skins/photoblog/index.main.php
Expand Up @@ -160,7 +160,7 @@
?>

<?php
if( $disp != 'front' && $disp != 'download' && $disp != 'posts' )
if( $disp != 'front' && $disp != 'download' )
{
// ------------------------------------ START OF POSTS ----------------------------------------
// Display message if no post:
Expand All @@ -177,22 +177,6 @@
} // ---------------------------------- END OF POSTS ------------------------------------
echo '</div>'; // End of posts display
}
elseif( $disp == 'posts' ) {
// ------------------------------------ START OF POSTS ----------------------------------------
// Display message if no post:
display_if_empty();

echo '<div class="evo_content_block">'; // Beginning of posts display
while( $Item = & mainlist_get_item() )
{ // For each blog post:
// ---------------------- ITEM BLOCK INCLUDED HERE ------------------------
skin_include( '_posts_media_index.inc.php', array(
'content_mode' => 'full', // We want regular "full" content, even in category browsing: i-e no excerpt or thumbnail
) );
// ----------------------------END ITEM BLOCK ----------------------------
} // ---------------------------------- END OF POSTS ------------------------------------
echo '</div>'; // End of posts display
}
?>


Expand Down

0 comments on commit f7304da

Please sign in to comment.