0

I am using codeigniter framework in php and I want set dynamic value from database to background image property in css, so I set the css file with .php extention and set header type

to but when I put any php code in css file it stops working, so please can anybody will help me??

4
  • 1
    The php code in css file? Please you share your code for more under standing. Commented Jun 20, 2016 at 5:15
  • stackoverflow.com/questions/1445424/… Please follow this answer. Commented Jun 20, 2016 at 5:52
  • <?php header("Content-type: text/css; charset: UTF-8 ");?> <?php $url=echo base_url(); $img1=$slidersInfo[0]['sliderImage']; $img2=$slidersInfo[1]['sliderImage']; $img3=echo $slidersInfo[2]['sliderImage']; ?> .bg-img-1 { background-image: url(../Admin/images/<?php echo $img1; ?>); } .bg-img-2 { background-image: url(../Admin/images/<?php echo $img2; ?>); } .bg-img-3 { background-image: url(../Admin/images/<?php echo $img3; ?>); } Commented Jun 22, 2016 at 4:24
  • my css file is as above ... Commented Jun 22, 2016 at 4:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.