hi all
I am working on a content management service and i need some help keeping formating.
what i am doing is recreating my site in an admin side and all of the articles on the site will now be in <textarea> boxes so admins can edit them and save the changes it is working but any formating they use dosen't seem to work. if they want to have a return
in the middle of their article the only way it will work is if they enter a br tag in the article. is there any way to keep also double spaces are turned to one. does anyone know how to fix all of this.
you can see the page at
http://www.steppinupwe bdesign.com/cms/index.php
and the admin page is
http://www.steppinupwe bdesign.com/cms/admin.php
thanks
eric
12 1860 Motoma 3,237
Recognized Expert Specialist This thread contains a discussion about converting line breaks to <br> and back.
Hi
I know it is probably somthing stupid i did but that didn't seem to work
on the three pages of where i am trying to use this i have put a copy of my php into html comments so that you can see them. i also posted what i feel is the important part below.
http://www.steppinupwe bdesign.com/cms/admin.php - the admin side
http://www.steppinupwe bdesign.com/cms/index.php - the display page
[PHP]
<?
if (isset($_POST['hometxt1title']))
$title = strip_tags($_PO ST['hometxt1title']);
if (isset($_POST['hometxt1txt']))
$text = ($_POST['hometxt1txt']);
if (isset($_POST['hometxt1author ']))
$author = strip_tags($_PO ST['hometxt1author ']);
if (isset($_POST['location']))
$location = strip_tags($_PO ST['location']);
$text=str_repla ce(array("<br>" ,"<br/>","<br />"), array("\n","\n" ,"\n"), $text);
mysql_query("UP DATE articles SET title = '$title', author= '$author', article = '$text' WHERE location = '$location'");
$result=mysql_q uery("SELECT id, title, author, article, location FROM articles");
$row=mysql_num_ rows($result);
?>
[/PHP]
Motoma 3,237
Recognized Expert Specialist
I'm not quite familiar with what you are trying to do, so perhaps you could explain what, exactly, the error/bug is as I look at your page.
hi
ok my admin page isn't labeled very well the first text box is the article title, the second is the author and the text area is the article. when typing the article if i press the enter button
it gets saved as one line
press the enter buttonit gets saved as one line
like shown above.
sorry about the unclarity
eric
Motoma 3,237
Recognized Expert Specialist
Okay, after you submit, you will need to replace the occurrences of "\n" with "<br />". I have some sample code in the link I posted earlier to do just this.
Hope this is what you are looking for.
Okay, after you submit, you will need to replace the occurrences of "\n" with "<br />". I have some sample code in the link I posted earlier to do just this.
Hope this is what you are looking for.
so i need to put it on the actual admin page before it submits or do i put it on the update page
and if on the admin page where
eric
Motoma 3,237
Recognized Expert Specialist
so i need to put it on the actual admin page before it submits or do i put it on the update page
and if on the admin page where
eric
You need to put it where you want it like that.
You need to put it where you want it like that.
Hi
for some reason this isn't working. i am not sure why but here is a sequence of everything that happens
[PHP]
if (isset($_POST['hometxt1txt']))
$text = ($_POST['hometxt1txt']);
$newtext=str_re place(array("<b r>","<br/>","<br />"), array("\n","\n" ,"\n"), $text);
$oldtext=str_re place(array("/n"), array("<br />"), $newtext);
echo '<br />', $newtext, '<br />', $oldtext, '<br />', $text;
[/PHP]
I am guessing that i am not using php v5 or above because the str_ireplace command made everything break
thanks
eric
Motoma 3,237
Recognized Expert Specialist
What about the above code isn't working? I am not sitting in front of a server to test the code, so perhaps you could explain what is breaking?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Polar |
last post by:
I have a database that stories entries of short stories for a writers
website. I can easily input the data into MYSQL but my trouble lies in
retrieving the data.
the story in just cut and pasted from a WP into the TEXTAREA on the form.
When I look at the story in the DB I can see it retains all the paragraph
spacing etc. but when I try and read that cell when retrieving data all the
text is crammed into one paragrapgh. What am I...
|
by: =?Utf-8?B?RHVja3dvbg==?= |
last post by:
Hello,
My code is suppose to write to an existing file. But after my C# code
appends the file, the previous text loses all the endline characters,
becoming one long line. How can I retain the formating of the pre-existing
text?
FileStream stream = new FileStream(strFileName, FileMode.Append,
FileAccess.Write);
|
by: Shawn Northrop |
last post by:
I just read an article on kirupa.com about incorporating mySQL and PHP with flash. I am dynamically loading conent into a flash movie and am not sure how to format. In my php code i have:
$y = "";
foreach($result as $x){
$y = $y . $x . " ";
}
print "myVar = $y";
In short $result is a query and $y is the value i will be passing along to flash.
the statement $y = $y . $x . " "; puts a space between each name that is passed along. I am...
|
by: sphinney |
last post by:
I have a datasheet style form with textbox (MyTextBox) that has the Text Format property set to "Rich Text". It is bound to a memo field in a table. How do I change the text or highlight color of certain text in the textbox such that the formating is saved in an underlying memo field?
My situation is a little different than other posts I read. Most posts show how to find and select certain text in a textbox, and then change the formating...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |