473,503 Members | 544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

writing between text

1 New Member
Hi
im making an html page generator using php
Im facing a problem tht for example of how to write text between text!!

what I mean is, if foe example a user wants to align some text in the center, how can I make that text insie the <center> tag

I have treid soo much but couldnt find anything
Jul 10 '11 #1
2 1410
johny10151981
1,059 Top Contributor
What did you tried actually?

Is it okay for you to show your code?
Jul 10 '11 #2
Atli
5,058 Recognized Expert Expert
Sounds like your just trying to do something like this:
Expand|Select|Wrap|Line Numbers
  1. $html = '<center>' .  $someText . '</center>';
Which you can also write as:
Expand|Select|Wrap|Line Numbers
  1. $html = "<center>$someText</center>";
  2.  
  3. // Or like this:
  4. $html = sprintf('<center>%s</center>', $someText);
  5.  
  6. // Or:
  7. $html = str_replace('<center>SOME_TEXT</center>', 'SOME_TEXT', $someText);

P.S.
The <center> tags are antiquated and really shouldn't be used. Instead, use CSS with normal structure tags, like <div> or <span> - For example, if all you wanted was a line of text centered on the screen, the "best practice" would be to do something like:
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <style type="text/css">
  5.         #myTextDiv {
  6.             text-align: center;
  7.         }
  8.     </style>
  9. </head>
  10. <body>
  11.     <div id="myTextDiv">Insert text here</div>
  12. </body>
  13. </html>
  14.  
And then you'd move the style into an external document later on, but this is a good start.

If you're having a hard time following the syntax of that example, I suggest you take some time to study CSS. It's a required skill if you plan on doing web-development these days.
Jul 10 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2043
by: Rob Meade | last post by:
Hi all, Ok - minor fly in my ointment... I have an application which was successfully writing data from submitted forms to a text file in a directory - in this case: /data/findata.txt ...
0
1738
by: Marshal Antony | last post by:
Hi, I have a web service creates a # delimited text file on a server different than the web server per day for tracking databse transactions.All transactions will be writing to this same text...
13
3521
by: Tim Johnson | last post by:
Hello all: I have a page with two frames named "menu" and "display". An event handler in "menu" changes the src attribute for "display", resulting in a different page being loaded for each...
8
104026
by: Primal-oooze | last post by:
In most newer browsers, would the following methods successfully write to the <div>s below? ------ <script> document.all.div1.innerText = "Some random text."; document.all.div2.innerHTML =...
3
2151
by: bbepristis | last post by:
Hey all I have this code that reads from one text file writes to another unless im on a certian line then it writes the new data however it only seems to do about 40 lines then quits and I cant...
8
2278
by: John | last post by:
Hi I am trying to set-up an app log file that needs to be created if does not exists but opened for append if exists. How does one go about doing this? ..net seems to have many ways to do io...
3
1354
by: =?Utf-8?B?am9obmFicmFoYW0xMDE=?= | last post by:
hello all, I've already posted a thread with the same problem but couldn't satisfactory answer. Let's come to the point. I can write some text to a text file with WriteAllText method. How can I...
2
4545
by: Clive Green | last post by:
Hello peeps, I am using PHP 5.2.2 together with MP3_Id (a PEAR module for reading and writing MP3 tags). I have been using PHP on the command line (Mac OS X Unix shell, to be precise), and am...
0
1134
by: buzzw | last post by:
Hi I have a wraptext procedure which accepts input text and fits it within given output length . Following is my test script Accept line Prompt 'enter text : ' Accept len prompt 'enter length...
17
2065
by: NYXX | last post by:
I wanna know how its possible to clone this website. www.writesomething.net I just want the actual programming code and files. I'm going to ceate a fully interactive website for users to input...
0
7281
Oralloy
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,...
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6993
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...
0
7462
tracyyun
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...
0
4675
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...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1514
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 ...
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.