Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1027279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:13:02+00:00 2026-05-16T12:13:02+00:00

I have a few pages which I’d like to have the same background across,

  • 0

I have a few pages which I’d like to have the same background across, so I figured an external style sheet would be the way to go. However, the background changes depending on the time of day, so I had to mix some PHP into the CSS. So now I have a file, background.php:

<html>
<style type="text/css">

body
{
    background-image: url('<?php echo (day() == 1 ? 'images/day_sheep.jpg'
                                                : 'images/night_sheep.jpg'); ?>');
    background-position: 50% 50%;
    background-repeat: no-repeat;
    background-color: silver
}

a {text-decoration:none;}
a:link {color:#ff0000;}
a:visited {color:#0000FF;}
a:hover {text-decoration:underline;}

</style>
</html>

Which is being called from two different pages. One page works perfectly fine, but the other page completely broke when I added the line require_once 'background.php', by which I mean nothing displays at all anymore. The offending page is as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Penelope's Conquests</title>

    <?php require_once 'background.php'; ?>

    <style type="text/css">

     table {
         margin: 10px;
         margin-left: 50%;
         margin-right: 50%;
         padding: 12px;
         border: 10px;
         text-align: center;
         background-color: #fffb40;
         border-style: ridge;
         border-collapse: separate;
         border-color: #9c6ad6;
         outline-style: inset;
           }

     td.cap {
            text-transform: capitalize;
            font-variant: small-caps;
            }

     td.str {
            font-weight: bolder;
            font-size: 1.4em;
            }

    </style>
</head>
<body>
    <h2>To date, Queen Penelope has destroyed:<br /><br /></h2>


    <?php

    require_once 'victims.php';
    require_once 'mysqlSheep.php';



   echo '<table border="3"
                frame="box"
                cellpadding="5">
         <caption>Penelope\'s Victims.</caption>
         <tr><th>Victim</th><th>Times Zapped</th>';

       $hits = mysql_query("
               SELECT *
               FROM victims
               ORDER BY amount
                          ");

       if( $hits )
       {
            while( $row = mysql_fetch_array($hits) )
            {
                   echo '<tr><td class="cap">'.$row['victim'].'</td>
                         <td>'.$row['amount'].'</td></tr>';
            }
       } 
       else
       {
            echo '<p>' . mysql_error() . '</p>';
       }

   echo '</tr></table><br /><br />';

   echo '<table border="3"
                frame="box"
                cellpadding="5">
         <caption>Button Clicks.</caption>
         <tr><th>Hour of day</th><th>Times Clicked</th>';

   $time = mysql_query("
                       SELECT *
                       FROM time
                       ORDER BY hits
                       ");

   while( $row = mysql_fetch_array($time) )
   {
       print "<tr><td class='str'>".$row['hour']."</td>";
       print "<td>".$row['hits']."</td></tr>";
   }


    ?>
</body>
</html>

Why doesn’t the page want to behave with the style sheet?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T12:13:03+00:00Added an answer on May 16, 2026 at 12:13 pm

    Ohhh, the issue is that the function day() is defined in a separate file, I forgot to move it over when I was reorganizing the site.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.