LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 07:32 PM   #1
pizzipie
Member
 
Registered: Jun 2005
Location: Hayden, ID
Distribution: Ubuntu 20.04
Posts: 441

Rep: Reputation: 12
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, 08:08 PM   #2
dogpatch
Member
 
Registered: Nov 2005
Location: Central America
Distribution: Mepis, Android
Posts: 490
Blog Entries: 4

Rep: Reputation: 238Reputation: 238Reputation: 238
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 08:44 PM. Reason: Cannot print ampersand
 
1 members found this post helpful.
Old 12-07-2019, 10:56 PM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

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

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

Rep: Reputation: 238Reputation: 238Reputation: 238
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 08:51 AM. Reason: correct thread link tag
 
1 members found this post helpful.
Old 12-08-2019, 02:27 PM   #5
pizzipie
Member
 
Registered: Jun 2005
Location: Hayden, ID
Distribution: Ubuntu 20.04
Posts: 441

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

R
 
  


Reply



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 05:21 AM
converting DOC to HTML using PHP Xing Programming 3 02-17-2009 06:32 AM
trouble finding policy doc as pdf in doc mirrors stardotstar Debian 2 05-12-2005 10:56 PM
Script to check Doc-BBB against Doc-AAA for inconsistence satimis Programming 2 11-09-2004 01:43 AM
Konqueror + file:/usr/share/doc/HTML/index.html jon_k Linux - Software 2 11-25-2003 05:06 AM

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

All times are GMT -5. The time now is 03:08 PM.

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
Open Source Consulting | Domain Registration