RE: [PHP] Methods for creating HTML with PHP

2004-03-26 Thread PHP Email List
> -Original Message-
> From: Jason Giangrande [mailto:[EMAIL PROTECTED]

> I'm looking for an easy way to write all my HTML using PHP.

Jason,

Sorry this is late and not even sure if you found your answer to this
question that you ask, however I think in the end it's going to be up to you
on how you do this as with anything, but the one thing that I do and prefer
is to include() my html with include files and ontop of that I have them in
functions so that like my header.php include page will allow me to change
the "title of the page", "the page topic" and some other functions specific
to my website. I find this way to be very convenient also for updates, I no
longer have to change all the files, I can update one template file and they
are all changed whenever that particular include is used. It's nice.

NOW!!  With that said, The one other thing I could suggest that I didn't see
anyone else mention, as you thought it was confusing to jump in and out of
html/php mode. Why not use heredoc?  I'm still new to php, so I'm not even
sure this is exactly what you wanted, but give it a look and see if this
would make your coding easier to follow? Just my 2 pennies!  :)

The manual doesn't have alot on this topic, heredoc is a string related
feature and can be found here...
http://us4.php.net/manual/en/language.types.string.php#language.types.string
.syntax.heredoc

If you google for "heredoc" or "here document" you'll find other pages of
reference. Like this gentleman even tested the speed difference from
echo/printing lines vs heredoc. Pretty interesting..
http://shat.net/php/notes/heredoc.php

Again not sure if this was what you where looking for but might just help
you since you don't have to use "print" statements and all html code can be
written inside and you can use variable interpolation. Heck you could even
use the include()(s) as well and place the heredoc in them for your
headers/footers/navigation/etc...

Good Luck,
Wolf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Methods for creating HTML with PHP

2004-03-25 Thread Burhan Khalid
Jason Giangrande wrote:
[ snipped ]
Also, is it possible to download a package marked beta with PEAR, or 
does it need to be downloaded manually?
Yes, you can do this, by running the following command:

$ pear config-set preferred_state beta

Then you can download beta packages.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Methods for creating HTML with PHP

2004-03-24 Thread David OBrien
At 08:20 PM 3/24/2004, Jason Giangrande wrote:
Raditha Dissanayake wrote:
How about just escaping out of php :-) and embedding the html direct?
Jason Giangrande wrote:
I'm looking for an easy way to write all my HTML using PHP.  I could do 
this with a bunch of print statements or the like, but that doesn't seem 
like a real good solution.  I noticed that PEAR has several packages for 
creating HTML.  Has anyone used any of these packages?
I'm particularly interested in the HTML_Common, HTML_Page, and HTML_CSS 
packages.  The HTML_Page package, which to me seems like the one package 
that actually outputs HTML, is marked as "beta".  Anyone know if there 
are any alternative packages that do a similar thing?

Also, is it possible to download a package marked beta with PEAR, or 
does it need to be downloaded manually?

Thanks,
That's the thing.  I'm looking for an alternative way of writing HTML into 
PHP pages.  I did a few simple pages a while ago just using print 
statements instead of closing the PHP tag and then writing HTML.  It made 
the code a little easier to follow.  The problem is that print statements 
can add up fast, so using to many of them in one page is probably just as 
hard to follow as closing a PHP block, so you can write some HTML.  That 
was why I was looking for an alternative way to write HTML in PHP pages.

I tried the HTML_Page class from PEAR, but it seems to have some issues 
still.  I guess that's why it's still in beta.  I've decided I'll try and 
write something on my own for now that incorporates a few things I've seen 
in other classes (mainly HTML_Common, and HTML_Page).
Jason
I have done this before and it worked for me not sure how much you need it 
though

include("header.htm")
some code
include("body.htm")
include("left_menu.htm")
more code
include("footer.htm")
?>

this way just php is in the main document and all the html is pulled from 
smaller html files elsewhere.
This will also allow you to reuse the html on every page kinda like a 
template system

you could also functionize the html

include("functions.php");
print_header();
and in functions.php

html here

This will also just let the code be in the main file and call the html from 
the functions.

-Dave

--
Jason Giangrande <[EMAIL PROTECTED]>
http://www.giangrande.org
http://www.dogsiview.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Methods for creating HTML with PHP

2004-03-24 Thread Jason Giangrande
Raditha Dissanayake wrote:
How about just escaping out of php :-) and embedding the html direct?

Jason Giangrande wrote:

I'm looking for an easy way to write all my HTML using PHP.  I could 
do this with a bunch of print statements or the like, but that doesn't 
seem like a real good solution.  I noticed that PEAR has several 
packages for creating HTML.  Has anyone used any of these packages?  
I'm particularly interested in the HTML_Common, HTML_Page, and 
HTML_CSS packages.  The HTML_Page package, which to me seems like the 
one package that actually outputs HTML, is marked as "beta".  Anyone 
know if there are any alternative packages that do a similar thing?

Also, is it possible to download a package marked beta with PEAR, or 
does it need to be downloaded manually?

Thanks,
That's the thing.  I'm looking for an alternative way of writing HTML 
into PHP pages.  I did a few simple pages a while ago just using print 
statements instead of closing the PHP tag and then writing HTML.  It 
made the code a little easier to follow.  The problem is that print 
statements can add up fast, so using to many of them in one page is 
probably just as hard to follow as closing a PHP block, so you can write 
some HTML.  That was why I was looking for an alternative way to write 
HTML in PHP pages.

I tried the HTML_Page class from PEAR, but it seems to have some issues 
still.  I guess that's why it's still in beta.  I've decided I'll try 
and write something on my own for now that incorporates a few things 
I've seen in other classes (mainly HTML_Common, and HTML_Page).

--
Jason Giangrande <[EMAIL PROTECTED]>
http://www.giangrande.org
http://www.dogsiview.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Methods for creating HTML with PHP

2004-03-24 Thread Raditha Dissanayake
How about just escaping out of php :-) and embedding the html direct?



Jason Giangrande wrote:

I'm looking for an easy way to write all my HTML using PHP.  I could 
do this with a bunch of print statements or the like, but that doesn't 
seem like a real good solution.  I noticed that PEAR has several 
packages for creating HTML.  Has anyone used any of these packages?  
I'm particularly interested in the HTML_Common, HTML_Page, and 
HTML_CSS packages.  The HTML_Page package, which to me seems like the 
one package that actually outputs HTML, is marked as "beta".  Anyone 
know if there are any alternative packages that do a similar thing?

Also, is it possible to download a package marked beta with PEAR, or 
does it need to be downloaded manually?

Thanks,


--
Raditha Dissanayake.
-
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php