Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
i’d like to add a fourth slide in the slider on the front page. I edited the file page—front.tpl.php and added the new pic definition new slide in the template.php file as follows, but it goes crazy.
PAGE-FRONT.TPL.PHP
<?php if ($slideshow_display): ?>
<div id="slider">
<div id ="slide" class="main_view">
<div class="slide-area">
<div id="divider_wrapper"><div id="divider"></div></div>
<div class="slide_image">
<?php print $slideimage1; ?>
<?php print $slideimage2; ?>
<?php print $slideimage3; ?>
<?php print $slideimage4; ?> // SLIDE 4
</div>
<?php if ($slide1_title || $slide1_desc):?>
<div class="descriptions" style="display: none;">
<div class="desc" >
<div class="desc_top" ><?php print $slide1_title; ?></div>
<div class="desc_bottom" ><?php print $slide1_desc; ?></div>
</div>
</div>
<?php endif; ?>
<?php if ($slide2_title || $slide2_desc):?>
<div class="descriptions" style="display: none;">
<div class="desc" >
<div class="desc_top"><?php print $slide2_title; ?></div>
<div class="desc_bottom"><?php print $slide2_desc; ?></div>
</div>
</div>
<?php endif; ?>
<?php if ($slide3_title || $slide3_desc):?>
<div class="descriptions" style="display: none;">
<div class="desc">
<div class="desc_top"><?php print $slide3_title; ?></div>
<div class="desc_bottom"><?php print $slide3_desc; ?></div>
</div>
</div>
<?php endif; ?> // SLIDE 4
<?php if ($slide4_title || $slide4_desc):?>
<div class="descriptions" style="display: none;">
<div class="desc">
<div class="desc_top"><?php print $slide4_title; ?></div>
<div class="desc_bottom"><?php print $slide4_desc; ?></div>
</div>
</div>
<?php endif; ?> // END SLIDE 4
</div>
<div class="paging">
<a rel="1" href="#"></a>
<a rel="2" href="#"></a>
<a rel="3" href="#"></a>
<a rel=“4” href="#"></a> // SLIDE 4
</div>
</div>
</div>
<?php endif; ?>
<!-- Slider Ends —>
TEMPLATE.PHP
// DEFINITION OF SLIDE 4
$vars['img4’] = base_path() . drupal_get_path('theme', 'bluez') . '/images/slideshow/slide-image-4.jpg';
$image4var = array(
'path' => $vars['img4’],
'alt' => $vars['slide4_title'],
'title' => $vars['slide4_title'],
'attributes' => array('class' => 'slide-img'),
);
$vars['slideimage4’] = theme('image', $image4var);
Comments
Comment #1
matfar CreditAttribution: matfar commentedComment #2
Ujval Shah CreditAttribution: Ujval Shah commentedYour Code is incomplete to render the new slide.
Comment #3
Ujval Shah CreditAttribution: Ujval Shah commentedFollowing Files need to update:
1. template.php
add below code after line number : 69
$vars['slide4_title'] = theme_get_setting('slide4_title', 'bluez');
add below code after line number : 73
$vars['slide4_desc'] = theme_get_setting('slide4_desc', 'bluez');
add below code after line number : 85
$vars['img4'] = base_path() . drupal_get_path('theme', 'bluez') . '/images/slideshow/slide-image-4.jpg';
add below code after line number : 107
2. theme-settings.php
Add below code after line number : 85
3. page--front.tpl.php
add below code after line number : 123
<?php print $slideimage4; ?>
add below code after line number : 150
add below code after line number : 163
<a rel="4" href="#"></a>
PS :
1. Do not forget to upload new image slide-image-4.jpg
2. After doing above changes do not forget to clear the cache of the site from admin/config/development/performance