Jump to content

how to select background by query string parameter?


megetron

Recommended Posts

hi,

I need a code that switch the background of a stylesheet according to url parameter.

I am using this (it wont work):

<div class="wFormContainer" style="width:880px; background-image: url(<?(empty($_GET['iswoman'])) ? 'l_banner1.jpg' : 'l_banner1_man.jpg';?>);background-color:#FFFFFF;background-repeat: no-repeat;margin:auto;">

 

please help

Define "it wont work".

here is the output:

<div class="wFormContainer" style="width:880px; background-image: url(<?(empty($_GET['iswoman'])) ? 'l_banner1.jpg' : 'l_banner1_man.jpg';?>);background-color:#FFFFFF;background-repeat: no-repeat;margin:auto;">

Replace <? with <?php echo .

now the output is this:

<div class="wFormContainer" style="width:880px; background-image: url(<?php echo (empty($_GET['iswoman'])) ? 'l_banner1.jpg' : 'l_banner1_man.jpg';?>);background-color:#FFFFFF;background-repeat: no-repeat;margin:auto;">

 

Does the following show image?

<div class="wFormContainer" style="width:880px; background: url('l_banner1_man.jpg'); background-color:#FFFFFF; background-repeat: no-repeat; margin:auto;">

 

How about this.

<div class="wFormContainer" style="width:880px; background: url('<?php echo (empty($_GET['iswoman'])) ? 'l_banner1.jpg' : 'l_banner1_man.jpg';?>'); background-color:#FFFFFF; background-repeat: no-repeat; margin:auto;">

 

Are images in the same directory as this file?

You're going to need to post more of the file. At least 10 lines before and 10 lines after the line you posted above.

ok here is the issue,

I added to my htaccess this lines:

<Files "default.php">

ForceType 'text/html; charset=UTF-8'

</Files>

 

after I remove this, your suggestion is working.

but now everything is encoded bad.,..

Here is the page:

http://cf.affilinn.co.il/selanet/education

please advise.

 

Then this is an Apache issue, not a php issue?

 

I struggle this for 24 hours this is frustrating.,..

 

 

The Hosting server says that I needs to change the code some how to add encoding support.

I add the META tag for UTF-8, and saved the file as utf-8 and even used the header() tag to change php utf-8....

the only way to make encoding work is to change the utf-8...

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.