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

matfar’s picture

Issue summary: View changes
Ujval Shah’s picture

Your Code is incomplete to render the new slide.

Ujval Shah’s picture

Status: Active » Closed (fixed)

Following Files need to update:

  1. bluez/template.php
  2. bluez/theme-settings.php
  3. bluez/templates/page--front.tpl.php

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

$image4var = array(
    'path' => $vars['img4'],
    'alt' => $vars['slide4_title'],
    'title' => $vars['slide4_title'],
    'attributes' => array('class' => 'slide-img'),
  );
  $vars['slideimage4'] = theme('image', $image4var);

2. theme-settings.php

Add below code after line number : 85

$form['bluez_settings']['slideshow']['slide4'] = array(
    '#type' => 'fieldset',
    '#title' => t('Slide 4'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['bluez_settings']['slideshow']['slide4']['slide4_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Slide Title'),
    '#default_value' => theme_get_setting('slide4_title', 'bluez'),
  );
  $form['bluez_settings']['slideshow']['slide4']['slide4_desc'] = array(
    '#type' => 'textfield',
    '#title' => t('Slide Description'),
    '#default_value' => theme_get_setting('slide4_desc', 'bluez'),
  );


3. page--front.tpl.php

add below code after line number : 123

<?php print $slideimage4; ?>

add below code after line number : 150

<?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; ?>

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