|
-
Oct 13th, 2007, 10:17 PM
#1
[RESOLVED] Easy formatting Q
I am building some html code dynamically but would like the source to look nicer then what it is. I believe the \n is supossed to do a line break similar to the <br /> but oin the raw html only and not the ooutputted display on the page.
I have this and its puking \n to the page.
PHP Code:
while ($cat = $db->fetch_array($cats))
{
$mycats .= '\n <tr>\n'.$cat;
}
But the "\n" isnt working and pukes to the screen.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 13th, 2007, 10:19 PM
#2
Re: Easy formatting Q
Bah, I knew it as soon as I posted it I would get it working.
Seems I had to use the double quotes for it to work. Why?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 13th, 2007, 11:17 PM
#3
Re: Easy formatting Q
well double quotes are supposed to be used only. Singles quotes should be used inside double quotes. "my cat 'oreo' is male". etc
Also, variables are only parsed in double quotes:
$name = "oreo";
echo "my cat $name is male";
and formating, i guess if only parsed in double quotes
My usual boring signature: Something
-
Oct 14th, 2007, 01:05 AM
#4
Re: Easy formatting Q
Well thats just plain 
Who designed this so called "language"? Its just completely backwards from anything that MS writes.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 14th, 2007, 09:57 AM
#5
Re: Easy formatting Q
 Originally Posted by dclamp
well double quotes are supposed to be used only.
That's completely incorrect: Single quoted string literals should always be preferred where possible.
Double-quoted literals are less efficient, since they must be parsed for variables and escape sequences (the only character that can be escaped in a single-quoted literal is a single quote).
 Originally Posted by RobDog888
Its just completely backwards from anything that MS writes.
I don't know how you figure that, since C# has two kinds of string literal as well: regular string literals, which are equivalent to double-quoted literals in PHP, and verbatim string literals, which are equivalent to single-quoted literals.
Including more language features hardly seems 'backwards' to me. Trying to write any non-trivial regular expression using a double-quoted literal in PHP or a non-verbatim literal in C# is horror-inducing, for example.
-
Oct 14th, 2007, 12:48 PM
#6
Re: Easy formatting Q
gah... i knew i was wrong. I read exactly what you wrote some where else, and forgot about it.
Thanks for clearing that up pena
My usual boring signature: Something
-
Oct 14th, 2007, 02:25 PM
#7
Re: Easy formatting Q
Well in C# at least you have identifier characters you can use to state its a string or such like the "@" and for slashes you just need to double up on them. Allot easier then having to escape everything all the time. 
Ok, so double quotes get a second pass of parsing making the "\n" to be taken as a line break vs puked out to the page. Thanks PG.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|