File "parts.php"

Full path: /home/fsibplc/public_html/sommilito-bank2/splide-4.1.3/src/js/test/php/parts.php
File size: 658 B (658 B bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php
function render( $id = 'splide01', $number = 10, $text = false ) {
  printf( '<div id="%s" class="splide" aria-label="Sample">', $id );
  echo '<div class="splide__track">';
  echo '<ul class="splide__list">';

  render_slides( $number, $text );

  echo '</ul>';
  echo '</div>';
  echo '</div>';
}

function render_slides( $number = 10, $text = false ) {
  for ( $i = 0; $i < $number; $i++ ) {
    echo '<li class="splide__slide">';

    if ( $text ) {
      printf( '<span>%s</span>', $i + 1 );
    } else {
      printf( '<img src="../../assets/images/pics/slide%02d.jpg"><button>button</button>', $i + 1 );
    }

    echo '</li>' . PHP_EOL;
  }
}