LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-07-2019, 08:32 PM   #1
pizzipie
Member
 
Registered: Jun 2005
Location: Hayden, ID
Distribution: Ubuntu 18.04
Posts: 271

Rep: Reputation: 8
get php to print html doc line by line - mine is all one string


Just beginning to try to create a PHP form generator. Php ends up producing all one string.

Code:
<?php
set_include_path( '../../include' );
error_reporting (E_ALL ^ E_NOTICE);

$str=<<<eot

&lt!DOCTYPE html&gt

&lthtml&gt

&lthead&gt

&ltmeta http-equiv="content-type" content="text/html; charset=UTF-8" /&gt`
	
&lttitle&gtCreate phpadmin() style SQL box - using dynamic html creation &lt/title&gt

&lt!-- ============== styles  ================ --&gt

&ltlink rel="stylesheet " type="text/css" href="css/query.css" /&gt

&lt!--  &ltlink rel="stylesheet " type="text/css" href="css/polly.css" /&gt  --&gt

&lt!-- ============== scripts1 ================ --&gt

&ltscript  type="text/javascript" src="../../jquery/jquery-2.1.1.js"&gt&lt/script&gt
&ltscript type="text/javascript" src="insertAtCaret.js"&gt&lt/script&gt
&ltscript type="text/javascript" src="connect.js"&gt&lt/script&gt
Result

Code:
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" />` <title>Create phpadmin() style SQL box - using dynamic html creation </title> <!-- ============== styles ================ --> <link rel="stylesheet " type="text/css" href="css/query.css" /> <!-- <link rel="stylesheet " type="text/css" href="css/polly.css" /> --> <!-- ============== scripts1 ================ --> <script type="text/javascript" src="../../jquery/jquery-2.1.1.js"></script> <script type="text/javascript" src="insertAtCaret.js"></script> <script type="text/javascript" src="connect.js">
 
Old 12-07-2019, 09:08 PM   #2
dogpatch
Member
 
Registered: Nov 2005
Location: Central America
Distribution: Mepis, Android
Posts: 398
Blog Entries: 4

Rep: Reputation: 181Reputation: 181
If you are outputting to a text file, append '[ampersand]#10;' to each place you want a newline.

If outputting to a web document, append '&lt;br&gt;'

NOTE TO JEREMY:
How can i get an ampersand to print in my first line? (See this thread)

Last edited by dogpatch; 12-07-2019 at 09:44 PM. Reason: Cannot print ampersand
 
1 members found this post helpful.
Old 12-07-2019, 11:56 PM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,991

Rep: Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441
(Made some tests with & symbols, their behaviour seems to be a bit inconsistent, specially after editing the post)

Last edited by NevemTeve; 12-08-2019 at 12:20 AM.
 
1 members found this post helpful.
Old 12-08-2019, 09:40 AM   #4
dogpatch
Member
 
Registered: Nov 2005
Location: Central America
Distribution: Mepis, Android
Posts: 398
Blog Entries: 4

Rep: Reputation: 181Reputation: 181
OK, back to the OP's question:

If you are outputting to a text file, append
Code:
&#10;
to each place you want a newline.

If outputting to a web document, append
Code:
&lt;br&gt;
You shoud also probably terminate your ampersand tags with a semicolon, thus
Code:
&lt;
-------------
(Thanks to pan64 in this thread for advice in printing an ampersand in an LQ post)

Last edited by dogpatch; 12-08-2019 at 09:51 AM. Reason: correct thread link tag
 
1 members found this post helpful.
Old 12-08-2019, 03:27 PM   #5
pizzipie
Member
 
Registered: Jun 2005
Location: Hayden, ID
Distribution: Ubuntu 18.04
Posts: 271

Original Poster
Rep: Reputation: 8
Thanks very much folks!!

R
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to capture 1000 lines before a string match and 1000 line a string match including line of string match ? sysmicuser Linux - Newbie 12 11-14-2017 06:21 AM
converting DOC to HTML using PHP Xing Programming 3 02-17-2009 07:32 AM
trouble finding policy doc as pdf in doc mirrors stardotstar Debian 2 05-12-2005 11:56 PM
Script to check Doc-BBB against Doc-AAA for inconsistence satimis Programming 2 11-09-2004 02:43 AM
Konqueror + file:/usr/share/doc/HTML/index.html jon_k Linux - Software 2 11-25-2003 06:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration