need help with page breaks

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zangief
Forum Newbie
Posts: 5
Joined: Thu Feb 02, 2006 8:46 pm

need help with page breaks

Post by zangief »

im using fopen functions right now coz we need reports to be in txt format. In this report, we need to go to another page once we got 30 rows of the table we're calling. Problem is, i dont know how to call a page break using fwrite. All i know is carriage return (\r) and newline (\n).

Is there a command for page breaks?

Thanks for the help in advance.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

The only way I know of making a page break is the css attribute .. do a quick search on google "page break css"

I could be completely off here though..
zangief
Forum Newbie
Posts: 5
Joined: Thu Feb 02, 2006 8:46 pm

Post by zangief »

i tried what you told me to do. but unfortunately for me, html codes cant be implemented in text files so i cant use class or <div>
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

any particular reason why you can't load the text file into php and output in html or other format??
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Do you mean you want the lines to be grouped into separate text files, 30 lines per text file? This does not make sense - "call a page break in fwrite"
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

there is a page break character in text files: 0x0C (12 in decimal) which is the Form Feed control character.
User avatar
shoebappa
Forum Contributor
Posts: 158
Joined: Mon Jul 11, 2005 9:14 pm
Location: Norfolk, VA

Post by shoebappa »

Hrm, after some research, you can appearently use the unicode \u000C, which I think represents a form feed.

http://forum.java.sun.com/thread.jspa?t ... ID=2117010

Notepad doesn't use this, but WordPad does. Use chr(12) to output the form feed.

Code: Select all

<?php

	echo "Page 1";
	echo chr(12);
	echo "Page 2";
	echo chr(12);
	echo "Page 3";

?>
If you wrote it to a txt file and opened it in WordPad it should print it on three pages. Copying the source of the output of that into WordPad works as well.

No clue what other text editors would do.
zangief
Forum Newbie
Posts: 5
Joined: Thu Feb 02, 2006 8:46 pm

Post by zangief »

Jcart wrote:any particular reason why you can't load the text file into php and output in html or other format??
actually, im calling data from the mySQL database and put those data into a text file. so its mySQL->PHP->text file.

thanks for some idea, ill try those right now, see what works.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

feyd wrote:there is a page break character in text files: 0x0C (12 in decimal) which is the Form Feed control character.
/me learned something new :P
Post Reply