Jump to content

Please help with php and css


lingo5

Recommended Posts

Hi,

I have the following css class to apply a bg image to a cell:

 

.imgBack {
background-image: url((<?php echo $row_images_trabajo_RS['imagen_path']; ?>));
background-repeat: no-repeat;
}

 

but it doesnt work....I would like to be able to use a dynamic image as the background. Can this be done?

 

Many thanks!

Link to comment
https://forums.phpfreaks.com/topic/248090-please-help-with-php-and-css/
Share on other sites

The background being blank doesnt really help find the problem.

Can you view the source of the CSS is see what is written in the background-images url source.

 

It may be empty, have the raw code there or even a PHP error. We really need to see the CSS source :)

OK, this is my table:

 

<table width="80%" border="0" cellspacing="0" cellpadding="6">
            <tr>
              <td width="26%" valign="top" class="imgBack" ></td>
              <td width="74%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="8">
                  <tr>
                    <td width="16%" align="left" nowrap="nowrap" class="CP_blueTXT">cambiar imagen</td>
                    <td width="34%"><input name="imagen_path" type="file" id="imagen_path" /></td>
                    <td width="25%"> </td>
                    <td width="25%"> </td>
                  </tr>
              </table></td>
            </tr>
          </table>

and this is my CSS style sheet:

 

.imgBack {
background-image: url((<?php echo $row_images_trabajo_RS['imagen_path']; ?>));
background-repeat: no-repeat;
}

 

This is the entire stylesheet:

 


@charset "utf-8";
.menulinks {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #FFF;
text-decoration: none;
font-weight: bolder;
background-color: #292D30;
text-align: center;
border-right-width: 1px;
border-right-style: dashed;
border-right-color: #999;
height: 27px;
width: 109px;
vertical-align: middle;
display: block;
line-height: 25px;

}
A.menulinks:hover {
text-decoration: none;
background-color: #FFF;
height: 27px;
width: 109px;
border-top-width: 0px;
border-right-width: 1px;
border-bottom-width: 0px;
border-left-width: 0px;
border-top-style: none;
border-right-style: dashed;
border-bottom-style: none;
border-left-style: none;
color: #464646;
text-align: center;
vertical-align: middle;
display: block;
border-right-color: #999;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
line-height: 25px;



}
.menulinks2 {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #FFF;
text-decoration: none;
font-weight: bolder;
background-color: #292D30;
display: block;
text-align: center;
height: 27px;
width: 109px;
vertical-align: middle;
border-left-width: 1px;
border-left-color: #CCC;
border-right-color: #CCC;
line-height: 25px;
}
A.menulinks2:hover {
color: #464646;
text-decoration: none;
background-color: #FFF;
height: 27px;
width: 109px;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 1px;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: dashed;
text-align: center;
vertical-align: middle;
font-size: 11px;
display: block;
border-left-color: #CCC;
line-height: 25px;
}
.CP_CargoText {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #85765F;
text-decoration: none;
letter-spacing: 1px;
}
.CP_welcomeText {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #333333;
text-decoration: none;
letter-spacing: 2px;
}
.CP_mainBackground {
background-color: #F3F3E0;
}
.CP_userPassText {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #999999;
text-decoration: none;
letter-spacing: 2px;
}
.CP_loginFormFields {
border: 1px solid #3370AF;
height: 23px;
}
.CP_loginButton {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #CCCA9D;
background-color: #FBFBF4;
border: 1px solid #CCCA9D;
}
.CP_back {
background-image: url(../../bibiloni/admin/CP_img/CP_back.jpg);
background-repeat: no-repeat;
background-position: bottom;
}
.CP_companyName {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
color: #B8B576;
text-decoration: none;
}
.CP_panelAdminTtle {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #666666;
text-decoration: none;
letter-spacing: 2px;
}
.CP_errorLoginTxt {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #090;
text-decoration: none;
}
.CP_LineTopBottom {
border-top-width: 1px;
border-bottom-width: 1px;
border-top-style: dotted;
border-bottom-style: dotted;
border-top-color: #B9B9B9;
border-bottom-color: #B9B9B9;
text-align: right;
}
.CP_LineBottom {
border-bottom-width: 1px;
border-bottom-style: dotted;
border-bottom-color: #85765F;
}
.CP_LineVertical {
border-right-width: 1px;
border-right-style: dotted;
border-right-color: #D6D6D6;
}
.PC_columnHeadingsText {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bolder;
font-variant: normal;
color: #000;
text-decoration: none;
text-transform: capitalize;
}
.CP_TableHeaders {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #F8F7F2;
text-decoration: none;
letter-spacing: normal;
}
.CP_ListingsText {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #85765F;
text-decoration: none;
letter-spacing: normal;
}
.CP_LineTop {
border-top-width: 1px;
border-top-style: dotted;
border-top-color: #85765F;
text-align: left;
}
.CP_TituloSecciones {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
color: #85765F;
text-decoration: none;
}
.CP_BodyText {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 11px;
line-height: 18px;
color: #85765F;
text-align: right;
}
.CP_editDelete {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
font-weight: normal;
color: #85765F;
text-decoration: none;
}
.CP_SiNoText {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #C63A17;
text-decoration: none;
letter-spacing: normal;
}.CP_errorLoginRed {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #BF0D1B;
text-decoration: none;
letter-spacing: 2px;
}
.bannerHomeBack {
background-image: url(../../bibiloni/img/banner-bg.jpg);
background-repeat: no-repeat;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
}
.preciosBanner {
background-image: url(../../bibiloni/img/banner_precios.jpg);
background-repeat: no-repeat;
}
.preciosBanner_cat {
background-image: url(../../bibiloni/img/banner_precios_cat.jpg);
background-repeat: no-repeat;
}

.CP_errorLoginRed {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #BF0D1B;
text-decoration: none;
letter-spacing: 2px;
}
.companyBack {
background-image: url(../img/company_back.gif);
background-repeat: no-repeat;
background-color: #FDFCEF;
}
.CP_loginFormFields {
border: 1px solid #3874B2;
}
.fondoTop {
background-image: url(../CP_img/airgom_header_admin.jpg);
background-repeat: no-repeat;
}
.pestanaBack {
background-image: url(../../metalesperez/img/pestanya2.gif);
background-repeat: no-repeat;
background-position: center center;
}
.TopBottomLine {
border-top-width: 1px;
border-bottom-width: 1px;
border-top-style: dotted;
border-bottom-style: dotted;
border-top-color: #3370AF;
border-bottom-color: #3573B0;
}
.LinksTXT {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #FFF;
text-decoration: none;
}
.LinksURL {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bolder;
color: #BA2F1C;
text-decoration: none;
letter-spacing: 3px;
}
.LinksSeparator {
font-family: Arial, Helvetica, sans-serif;
font-size: 9px;
color: #96AF32;
text-decoration: none;
letter-spacing: 2px;
}
.TitulosTXT {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 18px;
color: #7C4507;
font-weight: bolder;
}
.BottomLine {
border-bottom-width: 1px;
border-bottom-style: dashed;
border-bottom-color: #969260;
border-top-width: 1px;
border-top-style: none;
border-top-color: #969260;
}
.pestanaLiveview {
background-image: url(../../metalesperez/img/pestanyat.gif);
background-repeat: no-repeat;
background-position: center center;
}
.ContactBack {
background-image: url(img/link_bg2.gif);
background-repeat: no-repeat;
background-color: #F2F0DC;
}
.AddressTXT {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #333;
text-decoration: none;
}
.FormBorder {
border: 1px solid #999;
}
.fondoTabla {
background-image: url(file:///C|/wamp/www/finestresmallorca/img/sombra_taula.jpg);
background-repeat: no-repeat;
background-position: bottom;
}
.NovedadesBack {
background-image: url(file:///C|/wamp/www/finestresmallorca/img/novedad_bg_esp.gif);
background-repeat: no-repeat;
background-color: #FEFEFE;
}
.borderNovedadesTable {
border: 1px solid #CCCCCC;
}
.ErrorTXTCopy {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
color: #C00;
text-decoration: none;
letter-spacing: 4px;
font-weight: bolder;
}

.pestanaText {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #FFF;
text-decoration: none;
letter-spacing: 2px;
}
.bannerBorder {
border: 1px solid #E6E1B7;
}
.bodyTXT {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #333;
font-weight: normal;
text-decoration: none;
}
.distribuidoresTXT {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bolder;
color: #333;
text-decoration: none;


}

.calidadTXT {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #FFF;
text-decoration: none;
letter-spacing: 7px;
font-weight: bolder;
}
.siteBackground {
background-image: url(../../metalesperez/img/main-bg.gif);
background-repeat: repeat-x;
background-attachment: scroll;
background-color: #F2F0DC;
}
.footerBack {
background-image: url(../../metalesperez/img/footerbg.gif);
background-repeat: repeat-x;
background-attachment: scroll;
background-color: #3B3B3B;
background-position: 0px 0px;
}
.footerTXT {
font-size: 14px;
color: #FFF;
text-decoration: none;
padding-right: 5px;
padding-left: 5px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
text-align: left;
font-weight: bolder;
}
A.footerTXT:hover {
color: #FFF;
text-decoration: underline;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 12px;
}
.imagenBorder {
border: 1px solid #96AF32;
}
.precioCompra {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bolder;
color: #96AF32;
text-decoration: none;
}
.precioVenta {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bolder;
color: #BA2F1C;
text-decoration: none;
}
.personalTitulo {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 17px;
color: #3471B0;
line-height: 18px;
font-weight: bolder;
}

/* CSS Document */

.HeaderBack {
background-image: url(../CP_img/airgom_header_admin.jpg);
background-repeat: no-repeat;
}
.separadr {
color: #FFF;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 12px;
}
.companyFondo {
}
.CP_witheBottomLine {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #FFF;
}
.CP_nombreEmpresa {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #FFF;
text-decoration: none;
letter-spacing: normal;
}
.CP_blueTXT {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #3572B1;
text-decoration: none;
letter-spacing: normal;
}
.borderBotones {
border: 1px solid #FFF;
}
.TopLine {
border-top-width: 1px;
border-top-style: dotted;
border-top-color: #3573B0;
}
.CP_loginFormFieldsRED {
border: 1px solid #E80000;
height: 23px;
}
.CP_TXTAREAFormFields {
border: 1px solid #3370AF;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000;
text-decoration: none;
height: 220px;
width: 400px;
}
.EST_HeaderBack {
background-image: url(../estimator/EST_img/EST_header.jpg);
background-repeat: no-repeat;
}
.imgBack {
background-image: url((<?php echo $row_images_trabajo_RS['imagen_path']; ?>));
background-repeat: no-repeat;
}

 

and it is called using link...

Ok.

The CSS document you provided has no PHP code to fetch that information.

You will have to add the PHP code to read the information into the CSS document and do one of 2 things.

Create a .htaccess directive that lets PHP run inside a .css file or make the CSS file a .php document.

 

For example:

stylesheet.php

<?php
$images = array('one.jpg','two.jpg','three.jpg');
?>
... lots of css codes ..

.EST_HeaderBack {
background-image: url(../estimator/EST_img/EST_header.jpg);
background-repeat: no-repeat;
}
.imgBack {
background-image: url(<?php echo array_rand($images); ?>);
background-repeat: no-repeat;
}

then link it to your page like so

<link rel="stylesheet" href="stylesheet.php" type="text/css" />

 

 

so...would this be correct?

 

<?php
$images = 'echo $row_images_trabajo_RS['imagen_path'];';
?>

.menulinks {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #FFF;
text-decoration: none;
font-weight: bolder;
background-color: #292D30;
text-align: center;
border-right-width: 1px;
border-right-style: dashed;
border-right-color: #999;
height: 27px;
width: 109px;
vertical-align: middle;
display: block;
line-height: 25px;

}
A.menulinks:hover {
text-decoration: none;
background-color: #FFF;
height: 27px;
width: 109px;
border-top-width: 0px;
border-right-width: 1px;
border-bottom-width: 0px;
border-left-width: 0px;
border-top-style: none;
border-right-style: dashed;
border-bottom-style: none;
border-left-style: none;
color: #464646;
text-align: center;
vertical-align: middle;
display: block;
border-right-color: #999;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
line-height: 25px;



}
.menulinks2 {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #FFF;
text-decoration: none;
font-weight: bolder;
background-color: #292D30;
display: block;
text-align: center;
height: 27px;
width: 109px;
vertical-align: middle;
border-left-width: 1px;
border-left-color: #CCC;
border-right-color: #CCC;
line-height: 25px;
}
A.menulinks2:hover {
color: #464646;
text-decoration: none;
background-color: #FFF;
height: 27px;
width: 109px;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 1px;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: dashed;
text-align: center;
vertical-align: middle;
font-size: 11px;
display: block;
border-left-color: #CCC;
line-height: 25px;
}
.CP_CargoText {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #85765F;
text-decoration: none;
letter-spacing: 1px;
}
.CP_welcomeText {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #333333;
text-decoration: none;
letter-spacing: 2px;
}
.CP_mainBackground {
background-color: #F3F3E0;
}
.CP_userPassText {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #999999;
text-decoration: none;
letter-spacing: 2px;
}
.CP_loginFormFields {
border: 1px solid #3370AF;
height: 23px;
}
.CP_loginButton {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #CCCA9D;
background-color: #FBFBF4;
border: 1px solid #CCCA9D;
}
.CP_back {
background-image: url(../../bibiloni/admin/CP_img/CP_back.jpg);
background-repeat: no-repeat;
background-position: bottom;
}
.CP_companyName {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
color: #B8B576;
text-decoration: none;
}
.CP_panelAdminTtle {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #666666;
text-decoration: none;
letter-spacing: 2px;
}
.CP_errorLoginTxt {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #090;
text-decoration: none;
}
.CP_LineTopBottom {
border-top-width: 1px;
border-bottom-width: 1px;
border-top-style: dotted;
border-bottom-style: dotted;
border-top-color: #B9B9B9;
border-bottom-color: #B9B9B9;
text-align: right;
}
.CP_LineBottom {
border-bottom-width: 1px;
border-bottom-style: dotted;
border-bottom-color: #85765F;
}
.CP_LineVertical {
border-right-width: 1px;
border-right-style: dotted;
border-right-color: #D6D6D6;
}
.PC_columnHeadingsText {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bolder;
font-variant: normal;
color: #000;
text-decoration: none;
text-transform: capitalize;
}
.CP_TableHeaders {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #F8F7F2;
text-decoration: none;
letter-spacing: normal;
}
.CP_ListingsText {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #85765F;
text-decoration: none;
letter-spacing: normal;
}
.CP_LineTop {
border-top-width: 1px;
border-top-style: dotted;
border-top-color: #85765F;
text-align: left;
}
.CP_TituloSecciones {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
color: #85765F;
text-decoration: none;
}
.CP_BodyText {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 11px;
line-height: 18px;
color: #85765F;
text-align: right;
}
.CP_editDelete {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
font-weight: normal;
color: #85765F;
text-decoration: none;
}
.CP_SiNoText {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #C63A17;
text-decoration: none;
letter-spacing: normal;
}.CP_errorLoginRed {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #BF0D1B;
text-decoration: none;
letter-spacing: 2px;
}
.bannerHomeBack {
background-image: url(../../bibiloni/img/banner-bg.jpg);
background-repeat: no-repeat;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
}
.preciosBanner {
background-image: url(../../bibiloni/img/banner_precios.jpg);
background-repeat: no-repeat;
}
.preciosBanner_cat {
background-image: url(../../bibiloni/img/banner_precios_cat.jpg);
background-repeat: no-repeat;
}

.CP_errorLoginRed {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #BF0D1B;
text-decoration: none;
letter-spacing: 2px;
}
.companyBack {
background-image: url(../img/company_back.gif);
background-repeat: no-repeat;
background-color: #FDFCEF;
}
.CP_loginFormFields {
border: 1px solid #3874B2;
}
.fondoTop {
background-image: url(../CP_img/airgom_header_admin.jpg);
background-repeat: no-repeat;
}
.pestanaBack {
background-image: url(../../metalesperez/img/pestanya2.gif);
background-repeat: no-repeat;
background-position: center center;
}
.TopBottomLine {
border-top-width: 1px;
border-bottom-width: 1px;
border-top-style: dotted;
border-bottom-style: dotted;
border-top-color: #3370AF;
border-bottom-color: #3573B0;
}
.LinksTXT {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #FFF;
text-decoration: none;
}
.LinksURL {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bolder;
color: #BA2F1C;
text-decoration: none;
letter-spacing: 3px;
}
.LinksSeparator {
font-family: Arial, Helvetica, sans-serif;
font-size: 9px;
color: #96AF32;
text-decoration: none;
letter-spacing: 2px;
}
.TitulosTXT {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 18px;
color: #7C4507;
font-weight: bolder;
}
.BottomLine {
border-bottom-width: 1px;
border-bottom-style: dashed;
border-bottom-color: #969260;
border-top-width: 1px;
border-top-style: none;
border-top-color: #969260;
}
.pestanaLiveview {
background-image: url(../../metalesperez/img/pestanyat.gif);
background-repeat: no-repeat;
background-position: center center;
}
.ContactBack {
background-image: url(img/link_bg2.gif);
background-repeat: no-repeat;
background-color: #F2F0DC;
}
.AddressTXT {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #333;
text-decoration: none;
}
.FormBorder {
border: 1px solid #999;
}
.fondoTabla {
background-image: url(file:///C|/wamp/www/finestresmallorca/img/sombra_taula.jpg);
background-repeat: no-repeat;
background-position: bottom;
}
.NovedadesBack {
background-image: url(file:///C|/wamp/www/finestresmallorca/img/novedad_bg_esp.gif);
background-repeat: no-repeat;
background-color: #FEFEFE;
}
.borderNovedadesTable {
border: 1px solid #CCCCCC;
}
.ErrorTXTCopy {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
color: #C00;
text-decoration: none;
letter-spacing: 4px;
font-weight: bolder;
}

.pestanaText {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #FFF;
text-decoration: none;
letter-spacing: 2px;
}
.bannerBorder {
border: 1px solid #E6E1B7;
}
.bodyTXT {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #333;
font-weight: normal;
text-decoration: none;
}
.distribuidoresTXT {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bolder;
color: #333;
text-decoration: none;


}

.calidadTXT {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #FFF;
text-decoration: none;
letter-spacing: 7px;
font-weight: bolder;
}
.siteBackground {
background-image: url(../../metalesperez/img/main-bg.gif);
background-repeat: repeat-x;
background-attachment: scroll;
background-color: #F2F0DC;
}
.footerBack {
background-image: url(../../metalesperez/img/footerbg.gif);
background-repeat: repeat-x;
background-attachment: scroll;
background-color: #3B3B3B;
background-position: 0px 0px;
}
.footerTXT {
font-size: 14px;
color: #FFF;
text-decoration: none;
padding-right: 5px;
padding-left: 5px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
text-align: left;
font-weight: bolder;
}
A.footerTXT:hover {
color: #FFF;
text-decoration: underline;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 12px;
}
.imagenBorder {
border: 1px solid #96AF32;
}
.precioCompra {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bolder;
color: #96AF32;
text-decoration: none;
}
.precioVenta {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bolder;
color: #BA2F1C;
text-decoration: none;
}
.personalTitulo {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 17px;
color: #3471B0;
line-height: 18px;
font-weight: bolder;
}

/* CSS Document */

.HeaderBack {
background-image: url(../CP_img/airgom_header_admin.jpg);
background-repeat: no-repeat;
}
.separadr {
color: #FFF;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 12px;
}
.companyFondo {
}
.CP_witheBottomLine {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #FFF;
}
.CP_nombreEmpresa {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #FFF;
text-decoration: none;
letter-spacing: normal;
}
.CP_blueTXT {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #3572B1;
text-decoration: none;
letter-spacing: normal;
}
.borderBotones {
border: 1px solid #FFF;
}
.TopLine {
border-top-width: 1px;
border-top-style: dotted;
border-top-color: #3573B0;
}
.CP_loginFormFieldsRED {
border: 1px solid #E80000;
height: 23px;
}
.CP_TXTAREAFormFields {
border: 1px solid #3370AF;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000;
text-decoration: none;
height: 220px;
width: 400px;
}
.EST_HeaderBack {
background-image: url(../estimator/EST_img/EST_header.jpg);
background-repeat: no-repeat;
}
.imgBack {
background-image: url(<?php echo '$images'; ?>);
background-repeat: no-repeat;
}

No.

Where are you getting $row_images_trabajo_RS['imagen_path'] from?

It needs to be defined in your "CSS" document then you could use your existing code.

.imgBack {
background-image: url(<?php echo $row_images_trabajo_RS['imagen_path']; ?>);
background-repeat: no-repeat;
}

 

I have converted my CSS style sheet to .php and manually edited the link on my page.

 

I have then altered my CSS class to this:

.imgBack {
background-image: url(<?php echo $row_images_trabajo_RS['imagen_path']; ?>);
background-repeat: no-repeat;
}

...still no luck...no background image showing.

 

 

from a recordset I have in the page where I want to do the bg image trick

 

$colname_images_trabajo_RS = "-1";
if (isset($_GET['id_trabajo'])) {
  $colname_images_trabajo_RS = $_GET['id_trabajo'];
}
mysql_select_db($database_MySQLconnect, $MySQLconnect);
$query_images_trabajo_RS = sprintf("SELECT * FROM t_imagenes WHERE id_trabajo = %s", GetSQLValueString($colname_images_trabajo_RS, "int"));
$images_trabajo_RS = mysql_query($query_images_trabajo_RS, $MySQLconnect) or die(mysql_error());
$row_images_trabajo_RS = mysql_fetch_assoc($images_trabajo_RS);
$totalRows_images_trabajo_RS = mysql_num_rows($images_trabajo_RS);
?>

 

do you mean I have to have that RS query on the css.php file also?

What you can do as a quick fix is when you are using your link tag you can pass in the value as a GET parameter.

<link type="text/css" rel="stylesheet" src="css.php?background=<?php echo $row_images_trabajo_RS['imagen_path']; ?>" />

Then inside the css file you can use this.

.imgBack {
background-image: url(<?php echo (isset($_GET['background'] ? $_GET['background'] : ''); ?>);
background-repeat: no-repeat;
}

 

Edit: As long as the query result is called before the link is output to the screen.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.