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 9257953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:16:19+00:00 2026-06-18T12:16:19+00:00

My PHP isnt to great i am trying to build a small module for

  • 0

My PHP isnt to great i am trying to build a small module for joomla, at the moment i have this code:

<?php $a = array(1, 2, 3, 4); ?>
    <div class="bannercontainer">
        <ul>
<?php foreach($a as $v): ?>
    <li data-transition="fade" data-startalign="left,bottom" data-zoom="in" data-zoomfact="5" data-endalign="center,top" data-panduration="12" data-colortransition="4">
        <img alt="" src="images/slides/image1.jpg" data-thumb="images/thumbs/thumb1.jpg">
        <div class="creative_layer">
            <div class="clear"></div>
        </div>
    </li>
<?php endforeach; ?>
        </ul>
    </div>
</div>

which basically foreach number in the array generates a list item awith image etc for the slider.. but how would i associate other things with it, so that it generates but also depending on the settings in the xml file it also for example alters <li data-transition="fade" data-startalign="left,bottom" data-zoom="in" data-zoomfact="5" data-endalign="center,top" data-panduration="12" data-colortransition="4"> – this zoom effect and also the image path etc.

Any help greatly appreciated.. Thanks.

  • 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-06-18T12:16:20+00:00Added an answer on June 18, 2026 at 12:16 pm

    You need to predefine those values and store them inside the array you use. And don’t print ir out directly. It is better to store the output and print it out at the end:

    $a = array(
            array(
                'data-transition' => 'fade',
                'data-startalign' = > 'left,bottom',
                ...
                'data-thumb' => 'images/thumbs/thumb1.jpg'
            ),
            array(
                'data-transition' => 'no-fade',
                'data-startalign' = > 'top,bottom',
                ...
                'data-thumb' => 'images/thumbs/thumb2.jpg'
            )
            ...
        );
    
    $output = '<div class="bannercontainer">
                 <ul>';
    foreach( $a as $v ) {
        $output .= '<li data-transition="'.$v['data-transition'].'" data-startalign="'.$v['data-startalign'].'" data-zoom="in" data-zoomfact="5" data-endalign="center,top" data-panduration="12" data-colortransition="4">
            <img alt="" src="'.$v['data-thumb'].'" data-thumb="'.$v['data-thumb'].'">
            <div class="creative_layer">
                <div class="clear"></div>
            </div>
        </li>';
    }
    
    $output .= '</ul>
        </div>';
    
    echo $output;
    

    Basically what you are doing right now is creating a loop in the size of 4 and printing out the same thing.

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

Sidebar

Related Questions

I'm trying to set up PHP websockets on my website. This works great on
I have the following line of PHP code which works great: exec( 'wget http://www.mydomain.com/u1.php
I have been trying to solve a PHP regular expression problem for awhile now
Trying to figure out why my code isn't working. Basically I have an elseif
This is some code from a php file im working with. I need to
This block of code shown below using a php header redirect works locally, but
I have a bunch of sites that work great with nginx + php-fastcgi and
In PHP, filter_var('www.example.com', FILTER_VALIDATE_URL) returns false . Is this correct? Isn't www.example.com a valid
Im trying to write this script to say if email is valied insert into
I am having the hardest time trying to figure out this (should be) simple

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.