I'm not sure where to put my background image in this code and how to make the image transparent. Could you please help me out. Thank you

<?  
$pagetitle = "WaCoCo: Waterloo Community Coalition";
$pageid = "home";
include('includes/functions.php');
include('includes/header.php');
?>
	<?php

$dbcnx = @mysql_connect('localhost', 'root', 'bankside');
if (!$dbcnx) {
  exit('<p>Unable to connect to the ' .
      'database server at this time.</p>');
}

if (!@mysql_select_db('wacoco')) {
  exit('<p>Unable to locate the joke ' .
      'database at this time.</p>');
}

$pages = @mysql_query("SELECT * FROM pages where id=1");
if (!$pages) {
  exit('<p>Error retrieving categories from database!<br />'.
      'Error: ' . mysql_error(). '</p>');
}

while ($page = mysql_fetch_array($pages)) {

$maintext = $page["maintext"];
$maintext = bbcode_format("$maintext");
$sidebar1 = $page["sidebar1"];
$sidebar1title = $page["sidebar1title"];
$sidebar1 = bbcode_format("$sidebar1");
$sidebar2 = $page["sidebar2"];
$sidebar2 = bbcode_format("$sidebar2");
$sidebar2title = $page["sidebar2title"];
?>

<div id="col1">
	<?
	//include('includes/getflickr.php');
	?>

	<h2>Welcome to WaCoCo</h2>
	<p><? echo($maintext); ?></p>
	<font color="#993300"><h3>WaCoCo News</h3></font>

</div>
<div id="col2">
	<h2><? echo($sidebar1title); ?></h2>
	<p><? echo($sidebar1); ?></p>
		<h2>What's on</h2>

<?	include('includes/frontpagetoday.php');
?>
<p><a href="/events">Details of these events and more</a></p>

</div>
<div id="col3">
	<h2><? echo($sidebar2title); ?></h2>
	<p><? echo($sidebar2); ?></p>
<?	
	$news = @mysql_query("SELECT ArtID, ArtTitle, ArtDate FROM Article WHERE ArtMsg LIKE '%Waterloo%' OR ArtTitle LIKE '%Waterloo%' OR ArtLead LIKE '%Waterloo%' ORDER BY ArtID DESC LIMIT 0,2");
  if (!$news) {
    exit('<p>Unable to obtain news list from the database.</p>');
  }
 ?>
 <h2>Local news</h2>
<div class="smallnavcontainer">
<ul class="sectionnavlist">
 <?
 while ($newsrows = mysql_fetch_array($news)) {
    $newsid = $newsrows['ArtID'];
    $newstitle = $newsrows['ArtTitle'];
    $newsdate = date("j F Y",strtotime($newsrows[ArtDate]));

        // Start The Background Check 
        if($bgcolor == "#fff"){ 
            $bgcolor = "#eee"; 
        }else{ 
            $bgcolor = "#fff"; 
        } 
echo('<li class="smallnavlist" style="background-color:'.$bgcolor.';"><strong>'.$newstitle.'</strong><br/>'.$newsdate.'</li>');
  }
  ?>
</ul>
</div>
<p><a href="/localnews">See more local news</a></p>
</div>
<?
}

include('includes/footer.php');
?>

Recommended Answers

All 2 Replies

I'm not sure where to put my background image in this code and how to make the image transparent. Could you please help me out. Thank you

The background image url belongs in a style for the body tag.

I am not sure what you mean to make the image transparent. The background is supposed to be on the bottom, so there should be nothing under it to be seen through it.

If something is fully transparent, you can't see it.

If you intend to make the image very light and barely visible (like a watermark), you need to modify the image with your graphics editor before you upload it to the web server. Adjust the brightness and contrast of the image to get this effect.

There is nothing in standard html/css that allows an image to be partly transparent. There are some nonstandard features that do not work on all browsers. And there are scripts that do not work on all computers.

I still do not see why you want a transparent image.

Here's the CSS code for that:

body {
	background-color:#E2E8FE;
	background-image:url(images/backgroundimage.jpg);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.