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

Link to comment
Share on other sites

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;">

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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