Jump to content

Display single image


kradzcalypse
 Share

Recommended Posts

Hello,

There are 3 image fields which I want to display in a slideshow on page called main.php. The problem is I could not find the correct query strings. Please help me. TQ

main.php codes

<ul>
                                                            <!-- SLIDE  -->
                                                            <li data-transition="cube" data-slotamount="7" data-masterspeed="300" data-link="http://www.//portfolio/"   data-saveperformance="off" >
                                                                <!-- MAIN IMAGE -->
                                                                <img src="<?=$config->urls->templates;?>assets/wp-content/plugins/revslider/images/dummy.png"  alt="Modern-Marketing-Partners-Naperville2" data-lazyload="<?=$page->image->Slide1;?>" data-bgposition="center top" data-bgfit="cover" data-bgrepeat="no-repeat">
                                                                    <!-- LAYERS -->
                                                                </li>
                                                                <!-- SLIDE  -->
                                                                <li data-transition="cube" data-slotamount="7" data-masterspeed="300" data-link="http://www.//marketing-services/"   data-saveperformance="off" >
                                                                    <!-- MAIN IMAGE -->
                                                                    <img src="<?=$config->urls->templates;?>assets/wp-content/plugins/revslider/images/dummy.png"  alt="MMP_Homepage_D_nirvana" data-lazyload="<?=$image->url->Slide2;?>" data-bgposition="center top" data-bgfit="cover" data-bgrepeat="no-repeat">
                                                                        <!-- LAYERS -->
                                                                    </li>
                                                                    <!-- SLIDE  -->
                                                                    <li data-transition="cube" data-slotamount="7" data-masterspeed="300" data-link="http://www.//resources/"   data-saveperformance="off" >
                                                                        <!-- MAIN IMAGE -->
                                                                        <img src="<?=$config->urls->templates;?>assets/wp-content/plugins/revslider/images/dummy.png"  alt="Marketing-Next-Practices" data-lazyload="<?=$image->url->Slide3;?>" data-bgposition="center top" data-bgfit="cover" data-bgrepeat="no-repeat">
                                                                            <!-- LAYERS -->
                                                                        </li>
                                                                    </ul>
Link to comment
Share on other sites

Hi @kradzcalypse and welcome to the forums.

Instead of:

$page->image->Slide1

what you are looking for is:

$page->image->eq(n)

where "n" is the number of the image in the image field, starting at 0.

Since you named it "image" and not "images" is it set up to handle more than one image?

Link to comment
Share on other sites

I'm sorry, I don't quite understand. Do you mean the should be like this ?

 <img src="<?=$config->urls->templates;?>assets/wp-content/plugins/revslider/images/dummy.png"  alt="Marketing-Next-Practices" data-lazyload="<?=$page->image->eq(1);?>" data-bgposition="center top" data-bgfit="cover" data-bgrepeat="no-repeat">

what is eq ?

Link to comment
Share on other sites

Yep, that should do it.

Take a look at the cheatsheet for learning about eq.

You have three options for grabbing items from a PW array:

->first()
->last()
->eq(n)

Typically with a slider you foreach through $page->images as $image, but it seems like you only have three images and you have distinct URL links for each one, so calling each one individually like you have might just be easier.

Link to comment
Share on other sites

Problem solved by modifying code to :

<ul>
                                                            <!-- SLIDE  -->
                                                            <li data-transition="cube" data-slotamount="7" data-masterspeed="300" data-link="http://www.//portfolio/"   data-saveperformance="off" >
                                                                <!-- MAIN IMAGE -->
                                                                <img src="<?=$config->urls->templates;?>assets/wp-content/plugins/revslider/images/dummy.png"  alt="Modern-Marketing-Partners-Naperville2" data-lazyload="<?php echo $page->Slider1->url; ?>" data-bgposition="center top" data-bgfit="cover" data-bgrepeat="no-repeat">
                                                                    <!-- LAYERS -->
                                                                </li>
                                                                <!-- SLIDE  -->
                                                                <li data-transition="cube" data-slotamount="7" data-masterspeed="300" data-link="http://www.//marketing-services/"   data-saveperformance="off" >
                                                                    <!-- MAIN IMAGE -->
                                                                    <img src="<?=$config->urls->templates;?>assets/wp-content/plugins/revslider/images/dummy.png"  alt="MMP_Homepage_D_nirvana" data-lazyload="<?php echo $page->Slider2->url; ?>" data-bgposition="center top" data-bgfit="cover" data-bgrepeat="no-repeat">
                                                                        <!-- LAYERS -->
                                                                    </li>
                                                                    <!-- SLIDE  -->
                                                                    <li data-transition="cube" data-slotamount="7" data-masterspeed="300" data-link="http://www.//resources/"   data-saveperformance="off" >
                                                                        <!-- MAIN IMAGE -->
                                                                        <img src="<?=$config->urls->templates;?>assets/wp-content/plugins/revslider/images/dummy.png"  alt="Marketing-Next-Practices" data-lazyload="<?php echo $page->Slider3->url; ?>" data-bgposition="center top" data-bgfit="cover" data-bgrepeat="no-repeat">
                                                                            <!-- LAYERS -->
                                                                        </li>
                                                                    </ul>
Edited by kradzcalypse
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...