EOT; is for :) [quote] >If you stick to HTML you can still edit the layout with Dreamweaver and >I even use PHP to show/hide blocks of HTML, i.e[/quote] I do this too - the designers here use Dreamweaver and so I code my pages to enable them to make amends without needing my input. Rob... -- Rob Allen [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => <3efff932.603593341@news.btclick.com><3f0005d1$0$13006$afc38c87@news.easynet.co.uk> [htmlstate] => on_nl2br [postusername] => Rob Allen [ip] => robng@the-allen [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 8 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> Best Method using PHP & HTML ?? - PHP Development

Best Method using PHP & HTML ?? - PHP Development

What is the best method for creating a Web Page that uses both PHP and HTML ? <HTML> BLA BLA BLA BLA BLA <?PHP BLA BLA BLA BLA BLA ?> </HTML> OR <?PHP Echo "BLA" Echo "BLA" Echo "BLA" Echo "BLA" ?> OR <? Print "BLA" Print "BLA" Print "BLA" Print "BLA" ?> Thanks...

  1. #1

    Default Best Method using PHP & HTML ??

    What is the best method for creating a Web Page that uses both
    PHP and HTML ?

    <HTML>
    BLA
    BLA
    BLA
    BLA
    BLA


    <?PHP
    BLA
    BLA
    BLA
    BLA
    BLA
    ?>

    </HTML>


    OR

    <?PHP
    Echo "BLA"
    Echo "BLA"
    Echo "BLA"
    Echo "BLA"
    ?>

    OR

    <?
    Print "BLA"
    Print "BLA"
    Print "BLA"
    Print "BLA"
    ?>

    Thanks
    James Guest

  2. #2

    Default Re: Best Method using PHP & HTML ??

    > What is the best method for creating a Web Page that uses both
    > PHP and HTML ?
    There are a number of different ways of doing this, and I think your choice
    really depends on how you would like to do it. My personal favourite is not
    to include any HTML at all and just create PHP variables that contain my
    HTML. Then at teh end of teh doent I just use echo $output; This wouldn't
    work so well in cases where you want to flush the output back to the user as
    the script is being processed, but for short scripts this works well for me.

    Jamie


    Jamie Wright Guest

  3. #3

    Default Re: Best Method using PHP & HTML ??

    On Mon, 30 Jun 2003 08:45:36 +0000 (UTC), James nothere.com (James) hath writ:
    > What is the best method for creating a Web Page that uses both
    > PHP and HTML ?
    snip.....8<

    All the previous comments are On Target.
    Another point:
    It Depends.
    If you control the server, that's One Thing.
    How-some-ever, on one server site where I `manipulate` some
    web pages, .phtml and/or .shtml do not work for embedded
    <$php tags. I have no recourse but to bundle each target
    page up in a .php.

    Jonesy
    --
    | Marvin L Jones | jonz | W3DHJ | OS/2
    | Gunnison, Colorado | | Jonesy | linux __
    | 7,703' -- 2,345m | config.com | DM68mn SK
    Allodoxaphobia Guest

  4. #4

    Default Re: Best Method using PHP & HTML ??

    Zach Nakaska wrote:
    > If you needed to output a lot of variables in the HTML, then I would suggest
    > echo.
    Based on what? If you're talking about readability of code, I agree
    wholeheartedly. However, it says somewhere on the PHP site (though I
    don't have time to look right now to cite my source) that escaping into
    HTML (or, out of PHP, depending on your perspective) to print static
    text is actually faster than echoing it.

    Joshua Ghiloni Guest

  5. #5

    Default Re: Best Method using PHP & HTML ??

    James wrote:
    > What is the best method for creating a Web Page that uses both
    > PHP and HTML ?
    >
    > <HTML>
    > BLA
    > BLA
    > BLA
    > BLA
    > BLA
    >
    >
    > <?PHP
    > BLA
    > BLA
    > BLA
    > BLA
    > BLA
    > ?>
    >
    > </HTML>
    >
    >
    > OR
    >
    > <?PHP
    > Echo "BLA"
    > Echo "BLA"
    > Echo "BLA"
    > Echo "BLA"
    > ?>
    >
    > OR
    >
    > <?
    > Print "BLA"
    > Print "BLA"
    > Print "BLA"
    > Print "BLA"
    > ?>
    >
    > Thanks
    If you needed to output a lot of variables in the HTML, then I would suggest
    echo. However, if it were only a few, then you could do:

    <?
    $variable = "value";
    ?>
    <html><head></head><body>
    <b><?= $variable ?></b>
    </body></html>

    --
    Regards,
    Zach Nakaska
    Zach Nakaska Guest

  6. #6

    Default Re: Best Method using PHP & HTML ??

    Kevin Thorpe <kevinpricetrak.com> wrote in message news:<3f0005d1$0$13006$afc38c87news.easynet.co.uk >...
    > James wrote:
    > > What is the best method for creating a Web Page that uses both
    > > PHP and HTML ?
    >
    > I work differently. I write the bulk of my code at the top of the
    > doent then drop out of the php tags to output the html with as little
    > php in there as possible. This lets me hand a rough but functional
    > doent to my colleague who styles and polishes it in DreamWeaver. If
    > you take this a step further you can include the html to allow
    > alternative languages / representations.
    My PHP "style" has evolved over a couple of years and it's taken on
    this form with all the algorithm stuff at the top of the page before
    the <head>. I then just drop in small bits of PHP in the HTML.

    Using PHP to echo complex HTML is painful as you end up escaping all
    the " and having 50 lines of $html .= "" is time consuming and the
    layout is more fixed. If you stick to HTML you can still edit the
    layout with Dreamweaver and I even use PHP to show/hide blocks of
    HTML, i.e

    <?
    if ($displaythis) {
    ?>
    <table ...
    .... <td><?=$message?></td>
    </table>
    <?
    } else {
    ?>
    <table ...
    .... <td><?=$message?></td>
    </table>
    <?
    }
    ?>

    This makes the whole process so much easier and seems to be the best
    balance of HTML editability (with Dreamweaver) and power of PHP.
    Paul Liversidge Guest

  7. #7

    Default Re: Best Method using PHP & HTML ??

    James wrote:
    > What is the best method for creating a Web Page that uses both
    > PHP and HTML ?
    I agree with both of the others that it all comes down to personal
    style. I usually have my main pages as pure php control structures that
    include various html files for outputing the data. This means that you
    can open up both files in something like dreamweaver and edit them
    independantly. Depends on the site, depends on your style.

    Nigel Dunn Guest

  8. #8

    Default Re: Best Method using PHP & HTML ??

    In message <bf26a194.0306301335.43b6511aposting.google.com >, Paul
    Liversidge <paul_liversidgehotmail.com> writes
    >Using PHP to echo complex HTML is painful as you end up escaping all
    >the " and having 50 lines of $html .= "" is time consuming and the
    >layout is more fixed.
    That's what

    echo <<<EOT
    <!-- my html goes here using ", '
    and $variables as appropriate -->

    EOT;

    is for :)
    >If you stick to HTML you can still edit the layout with Dreamweaver and
    >I even use PHP to show/hide blocks of HTML, i.e
    I do this too - the designers here use Dreamweaver and so I code my
    pages to enable them to make amends without needing my input.

    Rob...

    --
    Rob Allen
    Rob Allen Guest

  9. #9

    Default Re: Best Method using PHP & HTML ??

    On 30 Jun 2003 14:35:27 -0700, [email]paul_liversidgehotmail.com[/email] (Paul
    Liversidge) wrote:
    >Kevin Thorpe <kevinpricetrak.com> wrote in message news:<3f0005d1$0$13006$afc38c87news.easynet.co.uk >...
    >Using PHP to echo complex HTML is painful as you end up escaping all
    >the " and having 50 lines of $html .= "" is time consuming and the
    >layout is more fixed.
    That's why I use ' instead of " for HTML attributes.
    >If you stick to HTML you can still edit the
    >layout with Dreamweaver and I even use PHP to show/hide blocks of
    >HTML, i.e
    I use CSS for layout which keeps the HTML simple and therefore my PHP,
    too.

    --
    David (please modify address to david before replying!)
    David Mackenzie Guest

Similar Threads

  1. Replies: 2
    Last Post: March 15th, 09:59 AM
  2. HTML <Href Link inside a form (HTML text box)
    By Lingodude in forum Coldfusion Database Access
    Replies: 1
    Last Post: February 15th, 08:31 AM
  3. Changing HTML in the Render() method
    By Benton in forum ASP.NET Building Controls
    Replies: 3
    Last Post: February 19th, 11:59 PM
  4. method name exists, property value exists, calling method fails
    By Phil Powell in forum PHP Development
    Replies: 0
    Last Post: October 27th, 07:34 PM
  5. method versus method!
    By Fred Werne in forum Ruby
    Replies: 2
    Last Post: October 15th, 04:19 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •