Display A Text File On A Web Page
I have a text file that I am trying to display on a web page. If I cat
or more the file it formats and displays fine. When it comes up in the
browser it seems to loose tabs and the format gets messed up. This is
how I display the file.
$show = file("./fields/combined/$cdp$store");
$arrayitems = sizeof($show);
$x=0;
while ($x < $arrayitems) {
print("$show[$x]
");
$x++;
}
If I edit the file it has ^M at the end of each line if it matters.
Does anyone have a better idea as to how to display it?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Read And Display Japanese Text From Text File
I posted a question regarding reading japanese text from a text file. Well, since I solved the problem, I thought I'd post my solution for the benefit of other people with the same problem. The plan was to make a script to read and display japanese text. I will use it for making a japanese proverb script and for a japanese language study script. Method : I wrote a simple kanji text file (saved with UTF-8 encoding) I wrote a simple PHP script to display the file contents (saved with UTF-8 encoding) I specified the content-type header for the HTML page : <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> *** All files have the same encoding. *** UTF-8 supports japanese characters. and it works! this is my PHP (and HTML) script : <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>PHP : Japanese Text File Read : Exercise 1</title> </head> <body> <?php $filename="japanese.txt"; //open file $fp = fopen($filename,'r'); //loop through each line in the file while($line=fgets($fp)) { //output current text file line print $line."<br>"; } //close file handle fclose($fp); ?> </body> </html> I know it's a very simple script, for testing purposes only. It displays the contents of the japanese text file line by line. The key was to save all files in the same encoding (I used UTF-8) and to specify the encoding / charset in the HTML header (<meta http-equiv="Content-Type" content="text/html; charset=utf-8">)
Text File Display
I have a number of SQL reports that create standard 132 column text files. The user wishes to view these files in a browser in addition to their daily printing on a laser printer. I can handle directory structure, etc with PHP but I would like to know what is the best way of displaying these text files on screen. We can select them but they are very plain. Is there a TXT2HTML ot TXT2XML type tool that can display headings, bolding, etc without too much difficulty. I would rather not reprogram the reports as there are hundreds of them, and embedding HTML would not be an answer as they need to be printed on a regular laser.
Display Results From Text File In Multiple Pages
i use a string, eg "&&&" to mark pages in a text file. i use $count to count the above string. how can i display the contents of this file in multiple pages (by identifying the above string or any other method)?
Display Results From Text File In Multiple Pages
i use a string, eg "&&&" to mark pages in a text file. i use $count to count the above string. how can i display the contents of this file in multiple pages (by identifying the above string or any other method)?
How Do You Display SPECIFIC File Types In A Directory On A Web Page Please?
Hello, I have the following code: <?php $handle = opendir('images/'); while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "<a href="images/$file">$file</a><br>"; } } closedir($handle); ?> which lists ALL the files in a directory as links on a web page. How do I limit it so it just shows Word documents for example?
Text File Download On .php Page
I have created a website in which I want to put a link to download a text file. When I used simple: <a href="Dir/File.txt">Download file</a> I had such problem that instead of dowloading the file contents was displayed in browser. In some book on PHP5 I found a "solution": create a...
Using PHP To Display News Text
I downloaded a php script from hot scripts called Blue Boy Whats New. I really like what he's done on his site for displaying news items. I got the admin part working and can add and edit news items. I can view the page created bb_news.php3, but when I try to include the php3 file in my home page nothing shows up.
Japanese Text Display
I have Japanese data coming from a mySQL database. It's internal encoding is EUC-JP and it is outputted as SJIS. This actually works just fine. My question comes from the fact that once these changes were made, all the static Japanese text on the page is botched. The meta tag in the head is set to Shift_JIS(SJIS) and it worked before the change. Any suggestions? I just can't see how the two match up... The encoding of the db info shouldn't affect the encoding of static info on the page should it? Especially when they are both output in the same encoding..
Display Html Text From DB
I've got a text box and basically the user types text in html format, I then use htmlspecialchars to convert special characters to HTML entities, fine not a problem I then store the text in a DB with the HTML entities in place. However when I want to display the text from the DB it still has the HTML tags in place and would like to render the HTML so to speak, how do I implement this? Sounds straightforward but need some pointers.
How To Cut Text And Display It Plus The Remaining Texts
just wanna ask if there's a way I can limit the text length i wanna display and display the remaining text below...?? let's say here's my string: $CallNum = $rows['CallNum']; this contains : Q179:1546:554-abc now i want to display this text like this: Q179: 1546: 554- abc
Display Text In Firebird BLOB
I have a Firebird 2.o Database. When I display the text content of a BLOB field, I get the following result. { tf1fbidisansiansicpg1252deff0{fonttbl{f0fswissfprq2fcharset0 Helvetica;}{f1fswissfprq2fcharset0 Calibri;}{f2fnil MS Sans Serif;}} {colortbl ; ed0green0lue128;} viewkind4uc1pardltrparqclang1033f0fs22 DURBANVILLE CONGREGATIONpar DEDICATED 28TH NOVEMBER 1999par. I use ibase_blob_echo to return a result. How can I get the result to display witout the rtf characters.
How To Display Text On Browser After Forcing Download
how do i display text to my browser after i force a download? heres my working script: Code: $selected_file = "/home/user/somelogfile.log"; header("Content-Type: text/plain"); header("Content-Disposition: attachment; filename=" . $_SERVER[HTTP_HOST] . "_" . $selected_file); header("Content-length: " . filesize($selected_file)); readfile("$selected_file"); what i want to do is display some text in my browser, but if i echo something after readfile(), it gets included in the download file, while i also cant echo before the download as headers need to be sent before any text .
Display MySQL Data In Text Field
I have my site set up and am now working on the admin side. I have a page that lets me search my users then its linked to another page so I can edit the information. I am attempting to get the code to display in my forms text boxes and text areas for updating. My problem is that I can't figure out how to get the data into my form for editing. I have a few different things but can't seem to figure this out.
Identify Url Written In Text Area And Display It Hyperlinked.
I am using html textarea control. user writes text in text area and i save it in database using php, then i display it where ever it is required. I want if user writes some url in the area like www.abc.com or http://www.abc.com , When i display this text as output this url must be shown there as hyperlink. by clicking over it user must be redirected to www.abc .com Is there any html textarea control property that can do it, or i need to write some php or javascript code for it. If someone has php script for it please help. It is urgent.
Read A Web Page And Then Display
I'd like to read a webpage, the parse it and display a small part of it. Here is what I've tired. It isn't working. <?php $handle = fopen("http://www.yahoo.com/", "r"); $contents = fread($handle, filesize($filename)); echo $contents; ?>
Link Display On Same Page?
I want to list the titles of all my articles from my database onto my webpage at articles.php. Then when the users click on each title, the individual articles will load on the same page. I'm new to PHP/MySQL, so here is what i've done so far. row[0] as my unique id numbers for each article, and i've included it so that i can somehow tell the page to load the article related to the unique id number. Is this all making sense? Code:
How To Display Image In Php Page
Looking for code for displaying image in .php3 page. I have tried this but not working. <img src="$picture" width="312" height="50" alt="$picture (83 bytes)"> where $picture ids a image file name i am getting form mysql database.
Display Data On Page
Ive got my page set up correctly as far as getting data into the database goes however I am not sure how to display it all on the page. Basically I have a news table: news_id, club_id, title, news I would like to display all the news items associated with the club that the user is logged into. Id like each news item to be separated so that its easy to identify they are different news items e.g. __________________________ $title $news __________________________ $title $news __________________________
Content Will Not Display Until Page Refreshed
I have a web site in php that is (trying to be) a local directory. The first and second pages (index.php and index2.php) do not appear when going to the web site unless you hit the refresh button. The problem occurs with all I know who have visited the page. The problem "disappears" if you visit the site and return in the same browser session -- presumably because it is now in the cache. My first foray into php was to update and expand a local directory I had made originally coded in html. I purchased the php "site" and modified it extensively, learning a very little bit along the way about PHP and MySQL and Apache server. I have submitted the issue to the ISP and to the program writer, each of whom points the finger at each other, and no solution. I have searched the forums to no avail -- I found one post in WirdPress.org that is unanswered, and another post in Joomla which was ansered with several suggestions to edit the .htaccess file, none of which worked. I have cleared my browser many times, but I doubt that is the problem (or else why would everyone who visits have the problem).
Trying To Display 1 Row Of Data On Static Web Page
I have a database with about 600 rows of data, and about 40 fields. I want to display 1 row of data at a time and populate it into a static web page in misc areas on that web page. I am having trouble displaying the results! Do I still need a loop even though I want one record at a time? Code:
Display Only A Certain Amount Of Content Per Page?
Basically, i am using file() and a for loop to display content from text files, but i don't want to have all the information displayed at the same time. I want to show the first 20 lines, then have a link saying "Click for the next 20 entries" which takes the user to the next page which has the next 20 lines. What is the simplest way to do this?
Opening A Page To Display The Right Info
I'm making a website where registered users can upload a photo as well as information. The main page will display all of the users' photos. When user1 clicks on, say, user5's photo i want a page to open up and user5's information. How do i do this? Every user has a username stored in the database along with their information and the url to their photo. Code:
Remove Text Header In Text File
I have been having trouble removeing two header lines at the top of my txt file. You will see in my code the different things I have tried but with no luck. Below I posted my script and data. I am doing a few other things in my script as you will notice but this is the only thing I am having troble with. Code:
Limiting Results, And Display Page Numbers
How do I make it so only 50 items display per page. And if there's more than 50, it displays a link "page 2", "page 3" and so on? I know how to limit results with MySQL but how do I generate pages for the next 50 within the PHP code?
WordPress Front Page Display Problem......What Should I Do?
I use wordpress's latest version. I found one problem. I set up that from Reading section only 5 post should be visible on my site and also summary size. After click on update button and refresh my browser and see that, my all post are showing on my site's front page and every post also full form. I don't know what's the problem. I am not expert in php.So, I can' fix it.
Refreshing A Page To Display Change In Data
I have a page that scrolls out information from a database. When one of the records has been completed by the user, they press delete at the end of the row, and it sends the record id to a processing page that deletes that record from the database, then returns to the scrolling page. However, the deleted record still shows on the page until one presses the refresh tab on the browswer. Is there some way I can have the page refresh when the processing is done, so that the changes made will be reflected immidiatly, instead of the user having to press the refresh button themselves?
List Of Sybmols Like To Display > On Html Page > And Which Are Others
i am making an application. the user can give description and that description is stored in database and then the description is shown on html page. suppose the user has written "<b>hello</b>" in description then in the database the following will be stored "<b>hello</b>" but when i display it on database the hello in bold letter will be displayed. i know the soultion that i have to replace the occurrences of < with < and occurrences of > with > but i don't know that which are other symbols which needs some repair like above so please give me a list of html symbols and their equivalent symbol.
Display Latest Input Without Refresh Page
I have a mysql database that store the results of a game. This database will frequently update (new result will insert after game finished). There is any script ( i think javascript) that will display the latest result without refresh the page.
Shows Code Doens't Display Page
When I try and view a page I installed with full permissions to my wwwroot directory it shows the code of the page it doesn't display the website.. I'm using IIS 5.1 with the newest PHP and MYSQL.. any ideas??
Display Values Of The Form Inside The Table On The New Page
I am generating data from database and displaying it inside input text boxes (for users to make some changes). What I need to do is when user presses "submit" button display all of the results inside the table on the new opened page. How can I do it?
Display Message Page During Server Side Processing
what is the standard way to "push" an intermediary message HTML page to the user while a server side process executes? for example, in many forums such as this one, you get an HTML page containing a message, like below, that displays while the application completes its process. "processing your post please wait and you will be returned to the forum". Then after the server side process is complete, it sends up the final result of the process, in the case of a forum, returning you to the thread you started or responded to. I plan to use something similar for file upload scripts so the user will have some sense of the status of the upload continuing, then finally receiving a message that upload was successful or failed due to some error. Can this be done through one script printing out two different HTML pages each with their own HTTP header?
Using The Same Page To Display A Hundred Pictures One Picture At A Time
I have over a hundred pictures I would like to present. Is it practical to create and parse an array of pictures, picture paths, et al using server-side scripting to accomplish this? I created an array already, and whereby, the HTML and Javascript currently used amount to about 14KB for each of four different pages, the PHP page I started working on is already over 35KB in size (most of it is server side processing creating the array of pictures). What I'd like to do, is load the array only one time, and keep that loaded so the page doesn't recreate the array each time, thus minimizing the server side array creation. Also, I think I'm running into some problems whereby the javascript is messing up Google's parsing of the page. I don't see creating 100 different html pages as an answer, in the respect if something ever changes, that's one big mess to update and major portion of the content and alot of files. Am I wrong in trying to avoid doing it via strictly HTML pages? The pages exist at, and they represent swimming pools designed by the owner of Aquatic Creations (North Carolina In-Ground Swimming Pool Designers): Custom Swimming Pool Water Features http://aquaticcreationsnc.com/lib/php/viewing0.php Custom Designed Swimming Pools http://aquaticcreationsnc.com/lib/php/viewing1.php Custom Designed Spas http://aquaticcreationsnc.com/lib/php/viewing2.php Custom Swimming Pool Features http://aquaticcreationsnc.com/lib/php/viewing3.php Stone And Tile Around Swimming Pools http://aquaticcreationsnc.com/lib/php/viewing4.php Does anyone have any suggestions on how to accomplish such or directions to pursue? If you could take a look as well and provide comments on the pages, I appreciate constructive criticism as well.
Getting The Text From A Web Page
I need to take a web page and parse the text from the site. I am thinking of using regex to kill the script and style sections, then strip tags or more regex to kill the reset of the non-text. I need to have the text categorized as sentences, so I some how have to keep track of how it is grouped with other text. I have two questions: 1) What do you guys think is the best way to do this? Regex, explodes, iteration, building a DOM structure, callbacks? 2) What would the regex look like if I wanted to find <, then any number of whitespace chatarers, then the word script, then anything except for (<, possible whitespace, /script, and then anything until >). Put another way, how can I match the style section of a document?
Q: Read Text With VBA From A PHP Web-page
I created a page on our intranet that shows a number and that increases for every time the page is opened. It is similar to a visitors-counter. When I look at the page with Internet Explorer it works just fine. Now I want to read this web-page from a MS-Word macro and include the number as a company wide unique id in my MS-Word document. Unfortunately, the PHP script doesn't update the counter when I call it from my MS-Word macro. How can I force PHP to update my counter when I call it from a VBA macro? I am using the following code:
Finding Text Within A Page
Basically I want to search a page for words and if they are found I want the script to do one thing. If they're not found, I want it to do something else.
How To Place Formatted Text On The Php Page
I'm entering data through textarea, and I want to display the same data on the form with all formatting settings. means, if I pressed enter while entering text in the textarea to make a separate line, the separate line has to come when displaying on the form also.
Changing Text On Page Via Dropdown Box.
I have a webpage that draws various text decriptions from a mySql database. The description displayed on the page is controlled via a dropdown box. Currently I am using Javascript with a dropdown box (onChange handler) to change the value of a textbox. Can anybody think of a way that I don't have to use a textbox(with its' scrollbars and background)? How can I change the value of a php variable by changing the selected index of a dropdown box?
Extract Only Plain Text From A Page
Basically, what I am trying to do is write some PHP code that will automatically take text from any web page and eliminate all the HTML, CSS, and JS codes and formatting, leaving only the plain text from the page. I got my code started, but I have hit a snag with javascript and css codes. This is what I have so far: <?php $geturl = $_GET["url"]; ob_start(); include($geturl); $page = ob_get_contents(); ob_end_clean(); $output = ereg_replace('<script.*.</script>', ' ', $page); $output2 = ereg_replace('<style.*.</style>', ' ', $output); $plaintext = strip_tags($output2); echo $plaintext; ?> The strip_tags function automatically removes all html tags, but it doesn't do anything to javascript and css because html code is not provided between the beginning and end tags, whereas javascript and css codes are both contained within two separate tags, like this for more clarification: html: <div name="htmltag">Keep this text here</div> javascript: <script>function somejs() {remove all this code}</script> As you can see, the text between the div tags should stay, but the js between the script tags should be removed because it is code. I then tried the ereg_replace function to get rid of js and css codes, but there is a problem when there is more than 1 piece of js or css code. The wildcard value (.*.) skips over any ending script or style tags until it reaches the last ending tag, therefore deleting all the text between the two pieces of code. Example: <SCRIPT>function somejs() {remove all this code}</script> //removes all text and code from beginning here KEEP ALL THIS TEXT HERE <script>function somejs() {remove all this code}</SCRIPT> //to end here Now finally down to the question, is there any way to only remove the js and css code between the beginning tag and the immediate next ending tag? Or is there any other way to get rid of the javascript and css codes?
Displaying Text While Page Is Loading
i'm trying to display text while a page is loading using a method similar to the following: <? ob_end_flush(); echo 'AAA<br>' flush(); sleep(10); echo 'BBB' ?> in this script, AAA and BBB appear at the same time - when the page has fully loaded - which is not what i want (i want AAA to appear and then 10 seconds later, BBB to appear). pursuant to the suggestions on php.net's entry for flush, i've also tried the following to no avail: <? echo 'AAA<br>' ob_flush(); flush(); sleep(10); echo 'BBB' ?>
|