This is an old revision of the document!


LightBox threading all images

RT which will combine (Prev/Next) all images (article / CPs / gallery / custom scripts) of a category (article) where the LightBox (SlimBox) is used.

If there are multiple pictures in an article from the article header, CPs and custom scripts, they (normally) can´t be connected by prev / next links with the LightBox.

To include all the images of the category (article header, CPs, gallery-script) into the sliding process you can use this RT.

(Also works with the extension MediaBox-Advanced).

<note> The RT actually will include the picture from the article head, the CP text w/image, the gallery script and all other scripts /CPs if the LightBox were activated here.

</note>


rt_lighbox_prev_next_all01.php V1.1 31.12.09

Docu: –
Forum: –

Autor: K.Heermann (flip-flop) http://planmatrix.de
CMS Version: >= 1.3
Version: V1.1
Update 05.08.2011 KH: Bug solved “If no category is specified in the array”.

Tag: –

Filename: rt_lighbox_prev_next_all01.php

Folder: template/inc_script/frontend_render/

Condition:/config/phpwcms/conf.inc.php

  • $phpwcms['allow_ext_render'] = 1;



Description

In the range === CUSTOM INPUT === of the RT can be indicated, for which categories this behavior is desired. For this we registered the IDs of the categories into the Array $_categories = array( );. Two characteristics: Include ot exclude this behavior.
Whether include or exclude is set up with the switch $inc_categories = true/false;.

true = include aktiv, false = exclude aktiv

Example:

  $inc_categories  = true;
  $_categories     = array(5,7,23,67);

In the categories with IDs 5,7,23,67 it is checked whether a Lightbox is active and the series of images can be combined (Prev/Next).
If $inc_categories = false; the pictures would be excluded of this operation in the categories with the ID 5,7,23,67.

<note> If the array $_categories = array( ); is empty, each category will be reviewed on the use of LightBox, regardless of the setting has been made in the $inc_categories.

</note>

Other parameters are:

—— Template range: Begin - End of the scan area

This area is marked in the template with <!-- bbbbbbbb //-->{CONTENT}<!-- eeeeeee //-->.

All other content placeholder as {LEFT}, {RIGHT}, {FOOTER}, {HEADER} or your own {CUSTOM_BLOCKS} can be integrated.
E.g. <!-- bbbbbbbb //-->{RIGHT}<!-- eeeeeee //-->

“bbbbbbbb” or “eeeeeee” are standing for the specified marker texts e.g. “bbbbbbbb” = “content-begin” and “eeeeeee” = “content-end” as
<!-- content-begin //-->{LEFT}<!-- content-end //-->.

$tag_before        = 'content-begin';  // Marking text for the beginning of the content to be scanned e.g. <!-- content-begin //-->
$tag_after         = 'content-end';    // Marking text for the end of the content to be scanned e.g. <!-- content-end //-->

—— Some specific parameters

$one_image_on      = true;    // true = include images without prev/next (one image),   false = exclude ...
$article_list_on   = false;   // true = include article images in article list mode,   false = exclude ...
$gallery_on        = false;   // true = include images generated by gallery script,   false = exclude ...


Code

rt_lighbox_prev_next_all01

<?php
/*********************************************************************************************
 V1.1  31.12.09 K.Heermann (flip-flop)
 "LightBox Prev/Next all": All LightBox images bind up
 New rel for all LB pictures is called: rel="lightbox[catid-XX]"
 Where XX is the current category ID.
 Update 05.08.2011 KH: If no category is specified in the array
 
 Filename: rt_lighbox_prev_next_all01.php
 Folder:   /template/inc_script/frontend_render/
 Switch:   $phpwcms['allow_ext_render'] = 1; (/config/phpwcms/conf.inc.php)
 
**********************************************************************************************/
 
// -------------------------------------------------------------------------------------------
// obligate check for phpwcms constants
  if (!defined('PHPWCMS_ROOT')) {
    die("You Cannot Access This Script Directly, Have a Nice Day."); }
// -------------------------------------------------------------------------------------------
 
// ===== CUSTOM INPUT ========================================================================
 
// ------ Some parameters if LightBox for images is set
 
$inc_categories    = true;    // true = include active,   false = exclude active
 
// ------ Fill in your inc/excluded categories e.g. array(7,23,16,25,33)
$_categories       = array( );
 
// ------ Template range
// begin - end of triggered content marked in template with <!-- bbbbbbbb //-->{CONTENT}<!-- eeeeeee //-->
$tag_before        = 'content-begin';  // Marking text for the beginning of the content to be scanned e.g. <!-- content-begin //-->
$tag_after         = 'content-end';    // Marking text for the end of the content to be scanned e.g. <!-- content-end //-->
 
// ------ Some specific parameters
$one_image_on      = true;    // true = include images without prev/next (one image),   false = exclude ...
$article_list_on   = false;   // true = include article images in article list mode,   false = exclude ...
$gallery_on        = false;   // true = include images generated by gallery script,   false = exclude ...
 
 
 
// ===========================================================================================
 
 
$text = '';
 
$cat_id     = $content['cat_id'];    // current category ID
 
if (count($_categories) == 0 ) $_categories[0] = $cat_id;  // Update 05.08.2011 KH: If no category is specified in the array
 
if ($inc_categories ) {  // include active?
 
    if ( in_array($cat_id, $_categories) ) {
 
//        $text = preg_match("/\<!-- content-begin \/\/--\>(.*?)\<!-- content-end \/\/--\>/ism", $content['all'], $g) ? $g[1] : '';
        $text = preg_match("/\<!-- $tag_before \/\/--\>(.*?)\<!-- $tag_after \/\/--\>/ism", $content['all'], $g) ? $g[1] : '';
    }
}
 
else { // exclude active!
 
    if ( !in_array($cat_id, $_categories) ) {
 
        $text = preg_match("/\<!-- $tag_before \/\/--\>(.*?)\<!-- $tag_after \/\/--\>/ism", $content['all'], $g) ? $g[1] : '';
    }
 
}
 
    if ( !$article_list_on AND ($content['list_mode'] == true) ) $text = '';  // in article list mode and include article images?
 
 
    // ------- lets go and pic up the images
    if (!empty ($text)) {
 
 
       if ($gallery_on) // all image CPs and the images from gallery too
 
          $text = preg_replace('/rel="lightbox\[(.*?)\]"/','rel="lightbox[catid-'.$cat_id.']"', $text);  // fill content
 
       else // all image CPs and no gallery images
 
          $text = preg_replace('/rel="lightbox\[[^gallery](.*?)\]"/i',
           'rel="lightbox[catid-'.$cat_id.']"', $text);  // fill content
 
 
       if ($one_image_on)  // images without prev/next (one image) like CP text w/image
 
       $text = str_replace('rel="lightbox"','rel="lightbox[catid-'.$cat_id.']"', $text);
 
 
       // And write it back
       $content['all'] = preg_replace("/\<!-- $tag_before \/\/--\>(.*?)\<!-- $tag_after \/\/--\>/ism",
               $text, $content['all']);  // fill content
    }
 
 
// -----------[ CLOSE ]----------------
?>
english/phpwcms_replacer_rts/frontend_render/lightbox-prev-next-threading/lightbox-images-threading.1312702746.txt.gz · Last modified: 2018/06/03 18:08 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0