Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query regarding .css files.

Status
Not open for further replies.

CHeighlund

Programmer
Jun 11, 2007
163
0
0
US
I'm having a bit of trouble figuring something out. I have a css file I use to attempt to break pages in the correct spot, and to force a landscape print so as to ensure that the words on the web reports my php program builds aren't packed together when printed out. The following is a complete copy of the text of the css file I use to do this-

p { page-break-before: always;}
@page

{
size landscape;
}


The css file is called from my program with the following command-

echo '<link rel="stylesheet" type="text/css" href="cancelheader.css"/>';


For some reason, I'm now having trouble getting this to work on a new program. As far as I can tell, the only differences are that a) the new program includes others that also make use of the page-break function, and b) the new files are in a different directory from the original css file. A copy of the css file has been placed in this directory, however.

Before, I've always used a single php file; now, I've got three separate files that get called from a single higher one. With this program, I cannot get the pagebreaks to occur when they are supposed to according to the css file.

I have tried the following to attempt to solve this:
1) Each of the original files included the reference to the css file. I commented those out, leaving instead a single copy in the higher-level file that calls(includes) them. This has not helped. Even a <p/> tag within the higher-level file does not break the way it should.
2) I tried to clear the cache, in hopes of solving the problem that way. This has not worked.
3) I closed down all browser windows (I thought this only applied to sessions, but I wanted to make certain) then opened up a new one and loaded the page again. This did not work.

I am using Firefox, version 1.5.0.12, to load the page.

Does anyone have any suggestions what my problem here might be, or solutions as to other things I can try to solve it?
 
Surely you're missing a colon?:

A missing colon is always messy.

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
You are correct. I was missing a colon in the size segment, but correcting that doesn't seem to have corrected the pagebreak problem. A test with a previous program pointing at the newly-made copy of the css file worked. I'm seriously starting to wonder if my breaking it into multiple files is what's causing the problem here.
 
I'm seriously starting to wonder if my breaking it into multiple files is what's causing the problem here.
What does the final html look like? Is there a redefinition of the p tag located after your css referenced above?

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
It may originally have been; the individual files I was calling in all used the same .css file. However, I commented out the original calls to link the .css file in them; only the link to it in the main file remains. And I can't see anywhere else in the html where I've got anything defining the p tag; all of my instances of it are <p/>.
 
I admit, I'm shamefully misusing them.

I'm writing a set of web-based reports for my boss, but with the caveat that the end user (not necessarily my boss) has to be able to print direct hardcopy of any given report straight from the web version. I'm not actually using paragraphs anywhere; that's the main reason I settled on the <p/> tag (empty paragraph) as a marker for my pagebreaks. The purpose of the breaks is to make sure that only 'x' number of report lines (as opposed to page lines) are printed on a page; that way, multiple-line report items won't end up getting broken across two pages.

The particular report I'm having a problem with is supposed to allow three layers of detail: Quick summary, basic details, in-depth details. I've got a separate php script for each of those items. Of them, only the in-depth detail report needs the pagebreak functionality, but I'll also need to be able to break between the 'basic' and 'in-depth' detail levels, so that the in-depth pages start on a fresh page.

When brought up in the browser by itself, the in-depth report breaks properly (if the line linking the .css file in isn't commented out). But, even though I directly copied that line to place in the larger php script that includes the others, when I call the larger include script it doesn't seem to recognize the breaks, whether the line in the in-depth report is commented out or not.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top