Uploading an image to a CSS stylesheet

3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 16, 2022   (RSS)

By Toledoh - March 14, 2022

Just add the image as an inline style to the slide itself, and remember to add a counter to change the slide number.

<?php $count=1 ?>
<?php foreach ($homepageRecord['main_slides'] as $index => $upload): ?>
<div class="single-slide-item slide-bg<?php echo($count) ?>" style="background-image: url('<?php echo htmlencode($upload['urlPath']) ?>') ;">
<div class="slide-item-table">
    <div class="slide-item-tablecell">
        <div class="container">
            <div class="row">
                <div class="col-md-7">
                    <div class="slider-heading">
                        <h2 class="slider__title"><?php echo htmlencode($upload['info1']) ?></h2>
                        <a href="<?php echo htmlencode($upload['info2']) ?>" class="theme-btn">Learn more</a></div>
                </div><!-- col-md-7 -->
            </div><!-- row -->
        </div><!-- container -->
    </div><!-- slide-item-tablecell -->
</div><!-- slide-item-table -->
</div>
<?php $count ++ ?>
<?php endforeach ?>
Cheers,

Tim (toledoh.com.au)

By CommonSenseDesign - March 16, 2022

Worked perfectly! Thank you.

https://www.showaterloo.org/home.php