LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-02-2007, 03:25 AM   #1
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,288

Rep: Reputation: 52
css question


Casual CSS user.
I have a small BASIC program that creates HTML scripts which all have their own CSS section between the <head></head> tags.

This CSS section includes random colours selected by the BASIC program.

These HTML scripts are then saved as a .PHP file which is called by a PHP "include" from other html.php scripts.

When these scripts created by the BASIC program are run from the console, they render properly, but when they are run from another PHP script through the "include", the colours of the first one are used for the following scripts although the rest renders properly.

It seems the <style type='text/css> .....</style> of (BASIC created) scripts are ignored starting from the second script.

The calls to these scripts are all made from within the same <table></table> in the calling script.

Could anyone tell me what could the problem be? Or am I doing something invalid?

Thank you for your help

example:

main script.php
....
<table ....><tr><td>
text
include basic made script 1
text
include basic made script 2
text
include basic made script 3
text
</td></tr></table>
....

Last edited by rblampain; 03-02-2007 at 03:28 AM.
 
Old 03-02-2007, 04:06 AM   #2
senyahnoj
Member
 
Registered: Jul 2004
Location: Gloucestershire, UK
Distribution: Ubuntu, Debian & Gentoo
Posts: 74

Rep: Reputation: 16
Can you post some of your scripts? would make it easier to understand what the problem is.
 
Old 03-02-2007, 06:22 AM   #3
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,288

Original Poster
Rep: Reputation: 52
Thank you for your answer.

Here is the main script, only the text has been removed.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Title.</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel=stylesheet type="text/css" href="../css.php">
</head>
<body class="pluie">
<table class="tabl01"><tr><td align="left">
<a name="1"></a>
<h3>Title 1.</h3>
<a name="2"></a>
<h3>Title 2.</h3>
<hr class="hr4">
<a name="3"></a>
<h3>Title 3.</h3>
<a name="4"></a>
<h3>Title 4.</h3>
<a name="5"></a>
<h3>Title 5.</h3>
<?php include 'charts/p1.chart01.php'; ?>
<a name="6"></a>
<h3>Title 6</h3>
<?php include 'charts/p1.chart02.php'; ?>
<a name="7"></a>
<h3>Title 7.</h3>
<?php include 'charts/p1.chart03.php'; ?>
<a name="8"></a>
<h3>Title 8.</h3>
<a name="9"></a>
<h3>Title 9.</h3>
<hr class="hr4">
<a name="10"></a>
<h3>Title 10</h3>
</td></tr></table></body></html>

And here is the first called script (charts/p1.chart01.php), these scripts are all identical except for the text and the colour, text also removed.

<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html><head><title></title>
<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>
<style type='text/css'>
.tabl02 {
width: 100%;
border-style: solid; border-width: 20px; color: #ff99ff;
background: #99ccff;
}
.box {
border-style: solid; border-width: 10px; color: #ff33ff;
background: #00ff00;
text-align: center;
}
.narow {
width: 16px;
border-style: none;
color: #99ccff;
text-align: center;
}
.larow {
border-style: none;
color: #99ccff;
text-align: center;
}
</style>
</head><body>
<table class='tabl02'>
<tr>
<td class='larow'></td>
<td class='narow'></td>
<td class='box'><br>Text here.<br><br></td>
<td class='narow'></td>
<td class='larow'></td>
</tr><tr>
<td class='narow'></td>
<td class='narow'></td>
<td class='narow'><img src='../imag/arows/da.png'></td>
<td class='narow'></td>
<td class='narow'></td>
</tr>
<tr>
<td class='larow'></td>
<td class='narow'></td>
<td class='box'><br>Text here.<br><br></td>
<td class='narow'></td>
<td class='larow'></td>
</tr><tr>
<td class='narow'></td>
<td class='narow'><img src='../imag/arows/lda.png'></td>
<td class='narow'></td>
<td class='narow'><img src='../imag/arows/rda.png'></td>
<td class='narow'></td>
</tr>
<tr>
<td class='box'><br>Text here.<br><br></td>
<td class='narow'></td>
<td class='larow'></td>
<td class='narow'></td>
<td class='box'><br>text here.<br><br></td>
</tr></table></body></html>
 
Old 03-02-2007, 07:26 AM   #4
senyahnoj
Member
 
Registered: Jul 2004
Location: Gloucestershire, UK
Distribution: Ubuntu, Debian & Gentoo
Posts: 74

Rep: Reputation: 16
Can't replicate the problem. I took your p1.chart01.php script and saved it. Then wrote the following php script:

PHP Code:
<?
include("p1.chart01.php");
?>
It displayed it in my browser, colours and all.

Am I missing something?
 
Old 03-02-2007, 07:47 AM   #5
cfaj
Member
 
Registered: Dec 2003
Location: Toronto, Canada
Distribution: Mint, Mandriva
Posts: 221

Rep: Reputation: 31
Quote:
Originally Posted by rblampain
Casual CSS user.
I have a small BASIC program that creates HTML scripts which all have their own CSS section between the <head></head> tags.

This CSS section includes random colours selected by the BASIC program.

These HTML scripts are then saved as a .PHP file which is called by a PHP "include" from other html.php scripts.

When these scripts created by the BASIC program are run from the console, they render properly, but when they are run from another PHP script through the "include", the colours of the first one are used for the following scripts although the rest renders properly.

It seems the <style type='text/css> .....</style> of (BASIC created) scripts are ignored starting from the second script.

The calls to these scripts are all made from within the same <table></table> in the calling script.

Could anyone tell me what could the problem be? Or am I doing something invalid?

Thank you for your help

example:

main script.php
....
<table ....><tr><td>
text
include basic made script 1
text
include basic made script 2
text
include basic made script 3
text
</td></tr></table>
....
Does the resulting page validate? Run it through the validator at validator.w3.org.

I suspect that you have <head> elements inside the <body>.
 
Old 03-02-2007, 11:40 PM   #6
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,288

Original Poster
Rep: Reputation: 52
Thank you for your help.

As I said in my initial questions, these scripts execute properly when run individually, the problem shows when they are called from the main script.

The first "include" always displays correctly, the second, third etc dont.

Yes, I have tried to validate the script, I get a message telling the file is of type octet but I can't figure out why.

<head></head> are before <body></body>

Last edited by rblampain; 03-02-2007 at 11:48 PM.
 
Old 03-03-2007, 12:08 AM   #7
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,288

Original Poster
Rep: Reputation: 52
We can ignore the main script.
Doing the following gives the same (unexpected) result.

<?
include("p1.chart01.php");
include("p1.chart02.php");
include("p1.chart03.php");
?>

I didn't think about testing it that way first.
It seems the CSS part of the scripts are ignored from the second script, in other words: the CSS part of the first scipt is applied to all scripts. There is probably a conflict between the various CSS definitions between all the scripts but my experience with CSS is not good enough to work out what it is.

Last edited by rblampain; 03-03-2007 at 12:13 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML/CSS/JS: Problem with <p> not having an absolute position with CSS. RHLinuxGUY Programming 7 03-03-2007 12:21 AM
CSS (stylesheet) question Spudley Programming 1 01-11-2006 10:21 PM
CSS Question iammisc Programming 2 12-19-2005 12:44 PM
CSS question PensJunkie Linux - General 2 07-22-2005 05:07 AM
css question tekmorph Programming 10 09-04-2004 09:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration