PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 10th, 2000, 12:42 AM
wdn2000's Avatar
wdn2000 wdn2000 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Apr 2000
Posts: 1,058 wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 6 Days 20 h 56 m 43 sec
Reputation Power: 21
Hi,

I'm new to PHP, so maybe I've simply
overlooked the obvious, but I was wondering
if PHP supports "Here" documents (like perl,
or UNIX shell). Any help would be greatly
appreciated! I hate having to all the
quotes in my HTML. =)

Scott

Reply With Quote
  #2  
Old April 10th, 2000, 09:27 PM
Dist Dist is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 31 Dist User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
I have no idea what you mean by "Here"-documents.. But I hope "having to " ment something even close to this:

In perl (it's been some time so forgive me for minor errors :
print "Bla?";
print <<EOF
<html>blablahHTML here
<a href="http://your_link_here">Hmm.</a>
</html>
EOF

In PHP:
print "Bla?";
?><html>blablahHTML here
<a href="http://your_link_here">Hmm.</a>
</html>
<?

Reply With Quote
  #3  
Old April 11th, 2000, 01:05 PM
wdn2000's Avatar
wdn2000 wdn2000 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Apr 2000
Posts: 1,058 wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 6 Days 20 h 56 m 43 sec
Reputation Power: 21
It looks like you're saying that if I want
to have large chunks of HTML code without
having to the quotes, I should just put
the HTML outside of the <? ?> tags.

There are two reasons that I wanted to have
all of my HTML within the PHP.

(1) I believe that my pages will execute
faster if they are entirely contained within
the PHP tags (rather than switching back
and forth)

(2) In perl you can embed variables in the
HTML contained in a Here document and I was
hoping that PHP could do the same.

Thanks for your help. =)

Scott

Reply With Quote
  #4  
Old April 12th, 2000, 07:01 PM
Dist Dist is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 31 Dist User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
You can do (almost like in perl) templates like this:

while($row=something(" ")) {
<?
Name: <? echo $row["name"] ?><br>
Address: <? echo $row["address"] ?><br>
<p>
?>
}

Reply With Quote
  #5  
Old April 12th, 2000, 08:11 PM
geosync geosync is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 8 geosync User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
here

<<<ENDH

endh can be any combination of characters which are not in the here document.

ENDH;

Reply With Quote
  #6  
Old April 13th, 2000, 04:20 AM
firepages's Avatar
firepages firepages is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: Perth West Australia
Posts: 757 firepages User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 18 m 32 sec
Reputation Power: 14
believe it or believe it not - you code gets parsed faster if you keep your <?php to a minimum - jumping in and out of php does not make things any slower - on larger files just the opposite.

------------------
Simon Wheeler
FirePages -DHTML/PHP/MySQL

Reply With Quote
  #7  
Old April 13th, 2000, 11:52 AM
wdn2000's Avatar
wdn2000 wdn2000 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Apr 2000
Posts: 1,058 wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 6 Days 20 h 56 m 43 sec
Reputation Power: 21
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by firepages:
believe it or believe it not - you code gets parsed faster if you keep your <?php to a minimum - jumping in and out of php does not make things any slower - on larger files just the opposite.
[/quote]

That's what I get for listening to those
NT/ASP guys! Thanks for the tip.

Scott

Reply With Quote
  #8  
Old April 13th, 2000, 11:54 AM
wdn2000's Avatar
wdn2000 wdn2000 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Apr 2000
Posts: 1,058 wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 6 Days 20 h 56 m 43 sec
Reputation Power: 21
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by geosync:
here

<<<ENDH

endh can be any combination of characters which are not in the here document.

ENDH;
[/quote]

Thanks! I'll give it a try.

Scott

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Are there "Here" documents for PHP?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap