Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4380502
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:32:34+00:00 2026-05-21T12:32:34+00:00

I want to have a Slideshow for each item. It is only working with

  • 0

I want to have a Slideshow for each item.

It is only working with the first one, for the others it doesn’t work.

Any idea what I’m doing wrong??

My code:

<?php
            // check $items variable exists and is not empty
            if(isset($items) && !empty($items)) :
                // init item count
                $count = 1;
            ?>
            <div class="shelf">

                <?php foreach($items as $key=>$item): ?>
                    <?php
                    // calculate if this item is the last on the shelf
                    // if item number can be divided by 5 with no remainders
                    $last_item = ( (($count) % 5 == 0)? 'item-last' : '' );
                    ?>

                    <div class="item <?php echo $last_item; ?>">
                        <a href="/items/view/<?php echo $item['Item']['slug']; ?>">
                        <p><?php echo $item['Item']['name'] ?></p>




                    <div id="CustomSlideshow">  


<?php
if ($item['Item']['vidsite'] = 'Pornhub') {

for($i=1;$i<=16;$i++) {
   $array[] = str_replace('.jpg',sprintf("%01d",$i).'.jpg',$item['Item']['vidimgdir']);
} ?>
<img src="<?php echo($array[0]); ?>"/>
<img src="<?php echo($array[1]); ?>"/>
<img src="<?php echo($array[2]); ?>"/>
<img src="<?php echo($array[3]); ?>"/>
<img src="<?php echo($array[4]); ?>"/>
<img src="<?php echo($array[5]); ?>"/>
<img src="<?php echo($array[6]); ?>"/>
<img src="<?php echo($array[7]); ?>"/>
<img src="<?php echo($array[8]); ?>"/>
<img src="<?php echo($array[9]); ?>"/>
<img src="<?php echo($array[10]); ?>"/>
<img src="<?php echo($array[11]); ?>"/>
<img src="<?php echo($array[12]); ?>"/>
<img src="<?php echo($array[13]); ?>"/>
<img src="<?php echo($array[14]); ?>"/>
<img src="<?php echo($array[15]); ?>"/>
<?php
 $array=array();
 } ?>


</div>                      

                        </a>
                    </div>

                    <?php
                    // if this is the last item, close the shelf div and create a new one
                    if(!empty($last_item)) {
                        echo '<div class="clear"></div>';
                        echo '</div>';
                        echo '<div class="shelf">';
                    }
                    ?>
                <?php $count++; ?>
                <?php endforeach; ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T12:32:35+00:00Added an answer on May 21, 2026 at 12:32 pm
    if ($item['Item']['vidsite'] = 'Pornhub') {
    

    My guess is you have forgotten one equality sign, so your code keeps assigning the same value to $item['Item']['vidsite'].
    One equality sign (=) assigns the value to the item, two (==) compare the operand, thus you should replace = with ==.
    Perhaps you already knew this and have just mistyped it. Don’t worry, I also used to make this mistake. 😉


    And by the way – if I were you, I’d replace the following code:

    for($i=1;$i<=16;$i++) {
       $array[] = str_replace('.jpg',sprintf("%01d",$i).'.jpg',$item['Item']['vidimgdir']);
    } ?>
    <img src="<?php echo($array[0]); ?>"/>
    <img src="<?php echo($array[1]); ?>"/>
    <img src="<?php echo($array[2]); ?>"/>
    <img src="<?php echo($array[3]); ?>"/>
    <img src="<?php echo($array[4]); ?>"/>
    <img src="<?php echo($array[5]); ?>"/>
    <img src="<?php echo($array[6]); ?>"/>
    <img src="<?php echo($array[7]); ?>"/>
    <img src="<?php echo($array[8]); ?>"/>
    <img src="<?php echo($array[9]); ?>"/>
    <img src="<?php echo($array[10]); ?>"/>
    <img src="<?php echo($array[11]); ?>"/>
    <img src="<?php echo($array[12]); ?>"/>
    <img src="<?php echo($array[13]); ?>"/>
    <img src="<?php echo($array[14]); ?>"/>
    <img src="<?php echo($array[15]); ?>"/>
    

    with this one:

    for($i=0;$i<=15;$i++) {
       $array[] = str_replace('.jpg',sprintf("%01d",$i).'.jpg',$item['Item']['vidimgdir']);
       echo '<img src="'.$array[$i].'"/>';
    } ?>
    

    Much shorter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a slideshow built in flash that I want to mimic in jQuery.
I have an image slideshow with navigation, with which I want to add an
I want to have a tree in memory, where each node can have multiple
I have a slideshow programed here that i want two images to be on
I want to create image slideshow in android. I have many images in android
I have a jQuery slideshow that displays a caption over each slide by taking
I have an object which creates a slideshow. I want to have several slideshows
i want have an image and i want to set it as a background
want to have a Hyperlink-Button in a gridView in which I can display a
I have want to save a form in Symfony2, based on a form type,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.