Jump to content

CSS background-image


NoDice
 Share

Recommended Posts

Hi all, 

I am really new in PW and didn't figure it out how it's working. 

I am trying to create a slider where user can change the images from admin panel. My issue is that the image from background of the slider is called from CSS, and don't know how to change to call it from the uploaded images. 

You can see my code down, where the css "hero-slider-bg-13" should be the image, but I have 3 slides and if is hardcoded like this will not change my image. 

 

Any advice? (this post is old, probably nobody will follow anymore)

<? foreach ($page->homeslide as $slide):?>
<div class="single-slider-item">
    <div class="hero-slider-item-wrapper hero-slider-item-wrapper--minimal-height hero-slider-bg-13">
        <div class="container">
            <div class="row">
                <div class="col-lg-12">
                    <div class="hero-slider-content">
                        <p class="slider-title slider-title--big-light"><?=$slide->slidertitle;?></p>
                        <p class="slider-title slider-title--big-bold"><?=$slide->sliderproductname;?></p>
                        <p class="slider-title slider-title--small"><?=$slide->body;?></p>
                        <a class="hero-slider-button" href="shop-left-sidebar.html"> <i class="ion-ios-plus-empty"></i> COMANDA ACUM!</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<? endforeach;?>
Link to comment
Share on other sites

On 2/5/2020 at 3:40 AM, Gideon So said:

You can do it with adding inline css rules like style="background-image: url("<?php $slide->yourImageField->url; ?>") "

Gideon

Thanks @Gideon So. I finally managed to do it as you suggested. I have made just a small correction as it didn't worked first

style="background: url(<?=$slide->sliderimage->url;?>) I have removed the " before opening the <?php

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...