Honesty Rocks! truth rules.

Php Picture Background.

HOME      >>       Websites and Web Designing

jsparky77

Hey,
I am a beginner with PHP and I was just just wondering how to put a picture background on my online store website. This is currently in development and its temporary home is http://forums.xisto.com/no_longer_exists/

If you need the code your browser should be able to get it when you visit the website.

Any help is greatly appreciated.


BuffaloHelp

Placing a background image is not just PHP programming. This is a basic HTML coding or CSS coding.

Since your site is open source os commerce, look for in stylesheet.css related to body or background.

Place CSS code

body {background-image: url('image/location/name.ext');}

There are other settings that background-image use such as repeat or no repeat, background default color, margin etc. Look up this property and apply them correctly.

Also, since your site uses table, be sure to attribute table correctly. Otherwise, you'll have white blanks where table is shown.

shadowx

Just to expand on this...PHP is a backend language. It never sees the light of day, all it does is spit out other languages and HTML is the one used to create webpages (usually) so you will also need to learn HTML and some CSS in order to be able to create webpages with PHP.Also beware that using a large image for a background will make your website slow to load, it is advisable to only use a tileable image (IE one that you can copy and paste next to itself and not notice the joins) or even better to use coloured areas with carefully placed images arranged using CSS as image backgrounds generally look old and tacky :)


kshan

Try the below script to add Background Image Using PHP

<?
$random = array(
'URL to image',
'URL to image',
'URL to image'
);
shuffle($random);
header("Location: $random[0]");
?>


ok, i only used 3 images but you can add more
just that last one where you put the image URL
cannot have a comma at the end because its ending the list

once you have inputed the URL's upload
*note all images do not have to be same size unless your putting them into the second code i give

once you have them uploaded just input the URL to the PHP script into the code given below

*note the code below is just the easiest and most common code people will use
there are other ways to use this code
such as the CSS Rollover Script i contributed a while back
http://www.createblog.com/myspace-scripts/325-css-rollovers/
or to place it in a regular image would be more difficult
you would have to make each image the same dimensions
and place the php script as a background image such as:

<div style="background-image:url('URL TO PHP SCRIPT'); width:XX; height:XX; overflow:hidden; visibility:visible">