Results 1 to 6 of 6

Thread: How to Switch from HTML to PHP?

  1. #1
    Join Date
    Aug 2006
    Posts
    221

    How to Switch from HTML to PHP?

    Hi friends,
    I have completed the basic topics that are needed for doing the programs in PHP programming language. I want to know about the switching from HTML to PHP. Instead of searching on the Web, I thought it would be better to ask you since you explain the topics very clearly.!! So please explain me how to Switch from HTML to PHP? Hope that you got the point and will reply me soon.!!
    AMD Sempron 2800+ @ 2Ghz
    Asus A7V8X-LA
    120Gb Seagate barracuda 7200Rpm Ultra-ATA 100
    Elixir 512mb DDR Pc3200 (Soon 1Gb)
    Club 3D Radeon 9600 256Mb
    Lite-On Cd & Dvd writer combo
    IDE-Dvd drive
    400w Psu
    Windows Xp Pro Sp2
    Advent Wireless Mouse & Keyboard.

  2. #2
    Join Date
    Jul 2006
    Posts
    286

    Re: How to Switch from HTML to PHP?

    When PHP parses a file, it searches the tags of opening and closing, which define the code that must be interpreted. In this way, it allows PHP to be embedded in all kinds of documents because everything is out of opening and closing tags is ignored by PHP. Most of the time you will see php embedded in HTML documents, as in the example below :
    PHP Code:
    <p>This sentence is going to be ignored.</p>
    <?php echo 'While this sentence is going to be parsed.'?>
    <p>This sentence will also be ignored.</p>
    IF you hate me, please don't mention it. I know who hates me and who doesn't. You really do not have to make fun of people....

  3. #3
    Join Date
    Jul 2006
    Posts
    442

    Re: How to Switch from HTML to PHP?

    You can also use more advanced structures, like I have given below :
    PHP Code:
    <?php
    if ($expression) {
        
    ?>
        <strong>This is true.</strong>
        <?php
    } else {
        
    ?>
        <strong>This is false.</strong>
        <?php
    }
    ?>
    This works as expected, because when PHP encounters the closing tag?>, It simply starts outputting whatever it finds until that it hits another opening tag. The example above is simple, of course, but for outputting large blocks of text, the shelving of this type of block analyzer PHP more efficient than sending the entire text using the functions echo() or print().
    "When they give you ruled paper, write the other way..." J.R.J.

  4. #4
    Join Date
    Mar 2008
    Posts
    672

    Re: How to Switch from HTML to PHP?

    There are four different pairs of opening and closing tags which can be used in PHP. Two of those, <? Php?> And <script language="php"> </ script>, are always available. The other two are short tags and ASP style tags, and can be activated or deactivated from the configuration file php.ini. However, despite the fact that people find short tags and ASP style tags practices, they are less portable and therefore generally not recommended. Also note that if you are embedding PHP within XML or XHTML you must use the <? Php?> so that you can remain compliant with standards.

  5. #5
    Join Date
    Oct 2005
    Posts
    2,393

    Re: How to Switch from HTML to PHP?

    The following is the PHP Opening and Closing Tags that could be useful for you in switching from HTML to PHP :
    PHP Code:
    <?php echo 'You want to change XHTML or XML documents, do it like this'?>
     
      <script language="php">
            echo 'some editors eg. FrontPage don\'t
                  like processing instructions';
        </script>
     
      <? echo 'this is the simplest, an SGML processing instruction'?>
        <?= expression ?> This is a shortcut for "<? echo expression ?>"
     
      <% echo 'You may optionally use ASP-style tags'; %>
        <%= $variable; # This is a shortcut for "<% echo . . ." %>

  6. #6
    Join Date
    May 2008
    Posts
    2,297

    Re: How to Switch from HTML to PHP?

    Short tags are available that if they were enabled via the short_open_tag configuration file php.ini or if PHP was configured with - enable-short-tags. The ASP style tags are only available when enabled via the asp_tags configuration file php.ini. You should keep in mind that using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on servers that are not under your control, because short tags may not be supported on the target server. To make portable code that can be redistributed, never use short tags.

Similar Threads

  1. Managed switch network speed vs. unmanaged switch network speed
    By LLoLL in forum Networking & Security
    Replies: 6
    Last Post: 22-07-2011, 07:28 PM
  2. Replies: 4
    Last Post: 14-04-2011, 02:06 PM
  3. Switch the 'action' field in an HTML form
    By MarceloQuad in forum Software Development
    Replies: 4
    Last Post: 07-02-2010, 06:05 AM
  4. Replies: 3
    Last Post: 22-09-2009, 01:12 PM
  5. How do I get the HTML code to display as HTML code?
    By NAYASA in forum Software Development
    Replies: 3
    Last Post: 26-12-2008, 01:35 PM

Tags for this Thread

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
  •  
Page generated in 1,716,524,431.16849 seconds with 16 queries