Formatting Text
I am currently looking for a way to have text that is entered in my news service (it is added to a databse, then displayed) to be cut off after a certain length on some pages (mainly the front page)...kind of like what you see on some sites with the "read more" at the end. I want it so i could enter a long news/article update, then on the home page it would be shortened, and when the user clicks on the title, it takes them to the detail page with the full length article. I am using dreamweaver, if that makes any difference.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
PHP Text Formatting
I'm wondering if someone can help me out with a small but no less importam problem I have? I'm using the code below to call text from a MySQL database field <td>".$rs[2]."</td> The problem is that the text appears with the web page like Sentence 1 Sentence 1 Sentence 1 and not like Sentence 1 Sentence 1 Sentence 1 as it should be, any suggestions?
Text Formatting
I'm having a problem with PHP, mysql and HTML. I am writing a message board for my site using PHP and mysql. I am running into a problem however with text formatting. Right now, the text for a message is entered into a text area. When the user submits the form the text is sent to a mysql database. All this works fine. My problem comes when reading the text FROM the database. If I use PHP to create a table and read the text into a cell, all of the formmatting is lost. No line breaks, tabs, etc... it just lumps all of the text together. I can use a <PRE> tag and then put the text in and it will preserve the formatting with line breaks, etc. The problem with this is that it wont word wrap. So if i type alot without a hard line break, then when it reads from the database using a <PRE> tag it puts all of the text on one line and stretches the table. Because the <PRE> tag will display it with its original formatting I know that the formatting is being stored in the mysql. So I either need to find out how I can wordwrap a <PRE> tag (in IE). OR I need to know how I can get PHP and HTML to restore the original format of the text without using a <PRE> tag.
Text Formatting
I have a forum on my site for people to post messages. Is there a way to get the text to format correctly when the user posts it? At the moment if a user types the following: ---- Hello everyone here is my shopping list: -egg -cheese -milk -bread ---- The results will look like: "Hello everyone here is my shopping list: -egg -cheese -milk -bread" All on the same line! How do I get it to recognize that there has been a new line created or any other html formatting for example and transfer it to the database so its displays correctly when it is recalled?
Text Formatting
I've been learning from the website for a long time now and I decided to start a small project. I'm writing some software that will be used by me as a type of blog, it's going really well and I'm almost finished. I've got a problem though, I wish to know how to do paragraph formatting. When I enter large amount of text inside a textbox, I want it to be formatted as it's typed in the textbox when it's output.
Text Formatting
Does anyone know how to use PHPBB text formatting feature inside of a CMS? OR does anyone know how to build there own. OR just know of any good artcles on it? I only need a few of the features, for example: - colour - size - font - alighment- bold - italic - underline bulletpoints.- URL How do you make it so when you highlight over the word, then click one of the buttons (url), the code then appears within the text area?
Formatting Text From Textarea
I have a html page that has a textarea with wrap =virtual that my client wants to just paste his info from emails and txt files into and then submit it to the db and it looks formatted there but when it gets submitted to the php page all returns and spaces are stripped and it is 1 long file that gets wrapped into my table??? Is there something I'm doing wrong or a command that will fix this? Code:
Echo Text Formatting
I'd like to format text that's returned as an echo from a form action ie. font colour alignment. Despite putting the css style on the php page I'm just getting default values. What's the secret please?
Formatting Text For A Textarea
im trying to format text for a textarea - the text comes from files which are (in essense) the same just what different content however the textarea is a part of a form so when it gets submitted it needs to be formatted for javascript so as far as i understand i need to strip the string for carriage returns (anything else?) but when i try this... $parsha = $parsha = preg_replace("/?/", "",$parsha); so this manages to work for about half of the files... but the other half are still not working... the truth is that i dont know if this is getting every carriage return - im not so clued up on regex... can someone please help me out here?
Text Formatting Functions Question.
I am working on trying to setup my content managment process for people to submit stories and poems, but cannot figure out how to get their text submissions to retain their formatting. I have read all the string info and searched this forum. I found a few things that sound like they should do what I need but when I try and apply them I do not get the desired result. I want to retain carriage returns and indenting and so forth. Here is a snippet that I was experimenting with that I thought should work but just ignored any indents and carriage returns <HTML> <BODY> <? if(!isset($submit)) { ?> <FORM METHOD=POST ACTION="texttest.php"> <TEXTAREA NAME="frm_text" ROWS="" COLS=""></TEXTAREA> <INPUT TYPE="submit" name="submit" value="Enter"> </FORM> </BODY> </HTML> <? } ELSE { echo <<<EOF $frm_text EOF; } ?>
Formatting Text For A Specific Width
I have a text file that will be written to with data from end users (text datatype). The text document is formatted such that there is a column of text around 200px wide, set in the middle of the page. Is there a way I can (or function that will) format a string (perhaps a paragraph or two) so that it will fit in this text document? Mind that the string is not a constant - it is entered by end users so I can't exactly hard code. .
Formatting Text In Word Document
I am building a web site that displays the contents from a MySQL database in a word file and saves it to disk. Problem is that I can create the file but I dont know how to format the text in the word document.
Mysql Output Text Formatting
I have stored data into mySQL through a multiple lines textarea input. When I try to print it out using the echo() function it doesn't print multiple lines, so everything is on one line. How can I fix this?
Formatting The Contents Of A Text Area Form Field
On my site I get users to enter a load of information in a textarea box, however when i save this data to my mysql DB and then retrieve it, it comes out without all the formatting, like new paragraphs and new lines. Can anyone tell me how you can capture the data entered into such a field with all the formatting the user has entered like new paragraphs etc?
Formatting
Does anyone know how to keep the formating of a textarea box (i.e. keep the lines and spaces between lines) when it gets put into a mysql table (the column set as text).
Formatting Of Dates From MDB With PHP
I am having a problem with Date formatting I am running PHP on an IIS box and my date formatting is coming out quite strange utilizing the following query: $strSQL = "SELECT Indiv.Lastname, Indiv.Firstname, IndivClient.StartDate, IndivClient.Type, IndivClient.StartDate FROM Indiv INNER JOIN IndivClient ON Indiv.NameID = IndivClient.NameID WHERE (((IndivClient.Type)='QSuspect') AND ((IndivClient.StartDate) Between $workday And Date()));"; and the following output code print "<td>$directory->value</td></tr>"; I get dates in this format 1021006800 If I use a simple date string I get dates in the normal d/m/y format.
Formatting Error In IE
I've created a form in php which displays and works perfectly in Opera. However, when I bring it up in IE, the text and input boxes are separated by almost half the page and the submit does not work. The code follows - any assistance would be appreciated.
Formatting A Date
I need to format a date in php to look like Sunday September 2. If the code is like this:
Date Formatting
I am trying to work out how to convert UK date format (DD/MM/YYY) to a format that will be accepted by MySQL (YYYY-MM-DD), so far I have been almost successful by using the following:- PHP Code:
Formatting Dates?
Im reading a csv file with php and getting a date in the form 30/09/07 Which I am trying to insert into a mysql table which has the field formatted as yyyy-mm-dd hh:mm:ss . I cant get it to insert the field remains blank How do I do this?...
Formatting Strings?
i have a row in one of my databases, and i use a timestamp to imput the current time into the row. Now, when i output the timestamp i get something like 20001218155634. I tried reading the php manual to help me on editing strings, but it wasn't of much help. So does anybody know any websites with good php string manipulating tutorials? or can anybody show me how to format the timestamp?
Formatting Dates
I can't get my date to properly display. It is $birthday. It is formatted as a time stamp. Previouslu, I had it in yyyy-m-d format. Neither worked! The output I get from the code below is Age: 33 (December 31, 1969). WHY? $today = time(); $age= ($today - $birthdate)/60/60/24/365.25; $f_age = sprintf("%01.0d", $age); echo "Age: $f_age "; $f_birthday = date("F d, Y", $birthday); echo "($f_birthday)<br>";
Date Formatting
how do I retrieve the current year to insert to the database. And how the date data is stored? is it yyyy/mm/dd or yyyy/dd/mm?
Formatting String
i have a variable that holds a string, the held string can be any string including HTML tags, here is an example. PHP Code:
String Formatting
i have built a forum for my site with php an mysql. a user submits raw text from a textarea into a table. when the text is pulled for display i run it through a function called "format_post( )." PHP Code:
Textarea Formatting
I am using a php html form with data which is loaded from a mysql database. Three of the fields are textareas. The data loads into these fields fine, except that the loaded text starts at what appears to be 2 or 3 tab characters to the left. See illustration: +---------<this is a textarea object>---------+ | This is about the way that| |the text loads from the database field. | | | | | +---------------------------------------------+ It's almost as if there's a textarea "align" property which is set to "center" by default unless otherwise explicitly stated. Is there some setting in the wrap property that will fix this, or should I be looking elsewhere?
Formatting Problem
I am using stripslashes(htmlspecialchars($myrow[1])) to display a record from the database. When I enter data in the form in the backend, I want to put <b>text</b> but this actually turns out as <b>text</b> on the webpage instead of bolding the word text. How do I make it so I can enter HTML in the backend textarea form fields?
Formatting A String
if i have a string like this: id=14,15,16,17 and some of the ids can be missing e.g. id = 14,,16,17 I would like to strip out the extra commas. Ive had a few goes trying different ways.
#$!%& Date Formatting.
I've looked through every OTHER date format thread, I've even tried 2 or 3 different methods of formatting the date. I even had a thread back in May about this, and I still haven't gotten it to work. PHP Code:
Formatting XML Data
I am currently working quite a bit with XML files and i keep running into the same problem. Many times i want to split the text into a paragraph, or make it an unordered list. How do you all format your XML idea.
Formatting Numbers?
How can I get from "5.99" to just "5"? I tried researching the manual, but they are full of rounding numbers and decimal points.
Textbox Formatting
say you've got this textbox that asks for a visitors first name. Is there a way to make the first letter of their name CAPITALIZED even if they typed it in lower-case? (i.e. they type "billyjoe" and I want the output to be "Billyjoe" with a capital B) I've been searching for a while, but haven't been able to come up with anything yet.
Formatting Number
Can sombody tell me the best way to format a number in this way. 456.45657 must be 456,46 So the point becoms a comma and I would have 2 digits i.pv. 5
PHP And Number Formatting
When I add 2 items in the cart less than $1000.00, the formatting of the numbers display fine. When for example I got 2 items that cost 3475.00, the total cost the the two items is displayed as 6, and NOT 3475.00. I am using the the sprintf function, and I believe my problem lies in the fact that I don't know the correct format to display numbers in excess of 1000.00?
Currency Formatting
i'm trying to format the output of a record in access, which i am pulling from through php (odbc) and the formatting is set at 4 decimal places, which i don't want. i want currency and no decimal places. I was trying to use this example, but i have no bloody idea howo to use it. or where to put it for that matter: <?php $number = 1234.56; // let's print the international format for the en_US locale setlocale(LC_MONETARY, 'en_US'); echo money_format('%i', $number)." "; // USD 1,234.56 ?>
Formatting Strings
I am currently using sprintf to format a report from a MySQL database data. I was wondering if there is an easy way to format text besides using sprintf. See below for the example I need to recreate. If any lines exceed the 75 column the need to wrap to the next line and indent 24 spaces. PHP Code:
Formatting Number.
I am trying to display prices on a shopping cart system, but need to be able to display the prices in the form £x.yy, at the moment I am getting things like: £4 £4.2 £4.123 How can I make PHP display a floating point number with only/at least 2 decimcal places?
Php Date-Formatting
I have a date value that I pull from a .csv file. After reading the file and storing the values in an array the value of the date could be found in $array[1], for example. while (($data = fgetcsv($handle,5000, ",")) !== FALSE) { $mydate = $data[3]; // here is the array value that holds the date } The date will be in either m/d/yyyy or mm/dd/yyyy format. Here is the problem. I need to display this date on the page in "long" format - i.e. January 5, 2005 instead of 1/5/2005 or 01/05/2005. I have tried to use the date() function, however I can only get the formatting to work with the current date and not with an 'existing' date. date("d.m.Y", $mydate); // this does not work, I get a date from 1969...
Number Formatting
I have a page that multiplies an amount of a part by the quantity of that part, then gives a total. For example: PART (costs $5.00, quantity of 3) That yields a total of $15. I want to it say $15.00 and I want it to round to the hundreths place in circumstances where a part may cost $3.6554, for example. How can I achieve this?
String Formatting
I have the following string - &=120=-&=127=-&=131=-&=135=-&=170=-&=171=-&=174=-&=175=-&=194=-&=196=-&=206=-&=222=-&=230=-&=236=-&=237=-&=240=-&=249=9 249=9 The important part are the numbers e.g. 120,127 and the dash or value after the = and before the & e.g. 236= (-) & The red part. I would like to separete them to get to display the dash only. how would I do this?
Formatting Currencies From An Int
If i have $Money = 200000; Then how can i get it to automatically place "," within that number, to convert it to a string? I can easily add "$" etc. but im stumped on this "," buisness.
Date Formatting
I have a table with a datetime field which is in the format "2007-06-20 00:00:00.000" using the following code I can display this nicely as dd/mm/yyyy (e.g. 20/06/2007). <?php $Format_Start_Date = ($Start_Date != '')?date("d/m/Y",strtotime($Start_Date)):''; ?> My question is this.... I now want to be able to edit these values by updating a form and I want the users to be able to enter the date in the format dd/mm/yyyy, can I edit the field so that it reads and updates as dd/mm/yyyy or alternately how would I convert the entry back to yyyy-mm-dd hh:mm:ss for the database to be updated?
Formatting A Date
I have two varibles, one called $cycle_through_the_month and another called $display_month. "$cycle_through_the_month" displays a date, such as "5" for the 5th day, "18" for the 18th day and so on "$display_month" displays a month and year, such as "MARCH 2007" or "NOVEMBER 2007". Combined together like "$cycle_through_the_month $display_month" produces something like 2 APRIL 2007 or 26 JUNE 2007. What I want to do is to format these so that they print out like 02/12/2007 or 29/11/2007
Email Formatting
I have a php form that is filled out and then submitted. When it is submitted a copy of the information that was submitted is sent to me via email and another person that is named on the form is also sent this same email. The copy the other person receives is fine. The copy I receive is all messed up, as if it is just all one single line with all formatting ignored. The form also generates a separate message to the person that filled out the form. This message is fine as well. Only the copy sent to me is messed up. To be sure the form is one php file, but it refers to another php file. Ok. I will admit that I am new to this. This form was created by someone that recently left the company. It was handed to me with the instructions to get it working. I just don't know where to start. I would copy and paste something, but I'm not sure what part you would want to see. Any direction would be most appreciated. I will try to learn PHP, but I cannot do it on the timetable my boss expects.
Paragraph Formatting
we have some paragraphs that have <BR>,<P> buried in them and want to modify them so that <BR> stars a new line and <P> begins a new paragraph. We tried the below: $NOTE = str_replace("<P>","n ",$NOTE); $NOTE = str_replace("<BR>"," ",$NOTE); It looks like the 1st replace does not work and the second one does. We are outputting the paragraphs to a PDF generatorn and it needs a text file with proper line and paragraph codes.
Date Formatting
Basically I have a few date fields in a table - last updated, next check due etc. There's also a DateAdded field which defaults to the date the record was created. The default format was 2008-01-01, but I've got that displaying using a recordset in Dreamweaver : SELECT date_format(DateAdded, '%%D %%b %%Y') as formatted_date FROM developments WHERE DevelopmentID = %s", $colname_dateformat1); This is fine. Following this principle I've done another couple for other dates and dropped them in. For dated I'd already added in the 2008-01-01 format, they display correctly. But my problem now is with entering them - as far as I can tell I'm drawing a blank with either 2008-01-01 or '%%D %%b %%Y' What's the best practice for entering them in the first place?
Ouput Formatting...
I would like to have the results of my query display in a grid format. The code below returns my thumbnails and links them to the actual images. However the entries in the database are simply paths to these images. I thought I could do this with CSS but the way this query is returning the results I am stuck and not sure how to resolve it. Any suggestions?
Textarea Formatting
Here is the scenario: In my php page I have a textarea for people to type into. When the users type their text and submit the form, all formatting is lost. Now, I did tell the users that this isn't a word processor! Anyway, I could use buttons similar to this forum to insert html tags like <p> etc, but, believe me, the users would never get the hang of how they work and they would delete them, and then cry about no formatting! All I really need is to have line breaks, just like the one above, which I got by hitting the Enter key twice. So, when I echo the text it will at least have 2 like breaks which will be fine for a paragraph break. I have looked at the manual, and at nl2br() in particular, but I'm not exactly sure how this works. It seems to be saying that when a user hits the Enter key, either or is added instead of <p>, and the database reflects this if I have a look...apparently. I'm not at the DB so I can't have a look. So, could someone explain to me how to use nl2br() (if that is indeed the correct function), or else perhaps how to retain the line breaks and paragraph breaks that the use enters in the html textarea please? Also, if I'm reading other's experiences with the same problem, do MAC's and PC's both use either or ? I'm a bit confused and most of our users use MAC's, but not all
Number Formatting?
Currently I am extracting a number from a mysql database. It is coming out as 4156 but how can i get it formatted so that it puts a , after the 4? 4,156 This record is dynamic so it is incremented all the time, so it will eventually get to something like 4324455 which should view as 4,324,455 How can I get this to work? Is there some function in PHP that does this?
|