I'm using the theme on a site that do not use the slideshow. The feature was then disabled on the theme configuration page, but all support code are being still included in the output, making it unnecessarily big and being a future potential conflict (e.g. use of a local jQuery cycle plugin). Since the enable/disable switch is there, the module should refrain from outputting any code related to the slideshow when this feature is disabled.

Attached is a patch that fix this issue. The patch itself is very small and straightforward (just an "if" test was added), though the patch looks big due to indenting.

CommentFileSizeAuthor
corporateclean-nojs.patch2.31 KBflaviovs
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gtsopour’s picture

Assigned: Unassigned » gtsopour

Thank you Flavio for the patch. This code will be included in next Corporate Clean release 7.x-1.5.

Thanks
/George

porfirio’s picture

Well, mabe add other option.
I disabled the internal slideshow but added a slideshow in a block.

With this i can have diferent slideshows in diferent pages.

gtsopour’s picture

Status: Active » Fixed
Issue tags: +corporate, +Corporate Clean Theme, +corporate clean, +Corporate Clean Slideshow

Hello flaviovs and porfirio,

finally, I just implemented and committed two theme-settings for slideshow code.

  1. The existing one for the slideshow markup code on front-page: slideshow_display
  2. and a new one for including (or not) the slideshow javascript code inside template.php: slideshow_js

I think that these two theme-settings cover all cases:

  • The default slideshow implementation
  • The deactivation of the front-page slideshow with keeping the slideshow javascript code for new internal slideshows
  • The total deactivation of the front-page slideshow and removal of the javascript code

page.tpl.php

<?php if (theme_get_setting('slideshow_display','corporateclean')): ?>
    
    <?php if ($is_front): ?>
    
    <!--slideshow-->
    <div id="slideshow">
    
        <!--slider-item-->
        <div class="slider-item">
            <div class="content">
                
                <!--slider-item content-->
                <div style="float:left; padding:0 30px 0 0;">
                <img height="250px" class="masked" src="<?php print base_path() . drupal_get_path('theme', 'corporateclean') ;?>/mockup/slide-1.jpg"/>
                </div>
                <h2>Sample product name</h2>
                <strong>General</strong><br/>
                <em>Client name</em><br/>
                <br/>
                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
                <div style="display:block; padding:30px 0 10px 0;"><a class="more" href="#">Tell me more</a></div>
                <!--EOF:slider-item content-->
                
            </div>
        </div>
        <!--EOF:slider-item-->
        
        <!--slider-item-->
        <div class="slider-item">
            <div class="content">
            
                <!--slider-item content-->
                <div style="float:right; padding:0 0 0 30px;">
                <img height="250px" class="masked" src="<?php print base_path() . drupal_get_path('theme', 'corporateclean') ;?>/mockup/slide-2.jpg"/>
                </div>
                <h2>Sample service name</h2>
                <strong>General</strong><br/>
                <em>Client name</em><br/>
                <br/>
                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
                <div style="display:block; padding:30px 0 10px 0;"><a class="more" href="#">Tell me more</a></div>
                <!--EOF:slider-item content-->
            
            </div>
        </div>
        <!--EOF:slider-item-->
        
        <!--slider-item-->
        <div class="slider-item">
            <div class="content">
            
                <!--slider-item content-->
                <h2>Sample product name</h2>
                <strong>General</strong><br/>
                <em>Client name</em><br/>
                <br/>
                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
                <div style="display:block; padding:30px 0 10px 0;"><a class="more" href="#">Tell me more</a></div>
                <!--EOF:slider-item content-->
            
            </div>
        </div>
        <!--EOF:slider-item-->
        
        <!--slider-item-->
        <div class="slider-item">
            <div class="content">
                
                <!--slider-item content-->
                <img height="250px" class="masked" src="<?php print base_path() . drupal_get_path('theme', 'corporateclean') ;?>/mockup/slide-3.jpg"/>
                <!--EOF:slider-item content-->
            
            </div>
        </div>
        <!--EOF:slider-item-->
    
    </div>
    <!--EOF:slideshow-->
    
    <!--slider-controls-wrapper-->
    <div id="slider-controls-wrapper">
        <div id="slider-controls">
            <ul id="slider-navigation">
                <li><a href="#"></a></li>
                <li><a href="#"></a></li>
                <li><a href="#"></a></li>
                <li><a href="#"></a></li>
            </ul>
        </div>
    </div>
    <!--EOF:slider-controls-wrapper-->
    
    <?php endif; ?>
    
<?php endif; ?>  

template.php

/**
 * Add javascript files for jquery slideshow.
 */
if (theme_get_setting('slideshow_js','corporateclean')):

	drupal_add_js(drupal_get_path('theme', 'corporateclean') . '/js/jquery.cycle.all.min.js');
	
	//Initialize slideshow using theme settings
	$effect=theme_get_setting('slideshow_effect','corporateclean');
	$effect_time=theme_get_setting('slideshow_effect_time','corporateclean')*1000;
	
	//Defined the initial height (300) of slideshow and then the slideshow inherits the height of each slider item dynamically
	drupal_add_js('jQuery(document).ready(function($) {  
	
	$("#slideshow").cycle({
		fx:    "'.$effect.'",
		speed:  "slow",
		timeout: "'.$effect_time.'",
		pager:  "#slider-navigation",
		pagerAnchorBuilder: function(idx, slide) {
			return "#slider-navigation li:eq(" + (idx) + ") a";
		},
		height: 300,
		after: onAfter
	});
	
	function onAfter(curr, next, opts, fwd){
		var $ht = $(this).height();
		$(this).parent().animate({height: $ht});
	}
	
	});',
	array('type' => 'inline', 'scope' => 'header', 'weight' => 5)
	);

endif;

These changes will be included in next Corporate Clean 7.x-1.5 release.

Thanks
/George

Automatically closed -- issue fixed for 2 weeks with no activity.