Results 1 to 3 of 3

Thread: Converting HTML stlyes

  1. #1
    Join Date
    Nov 2009
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Converting HTML stlyes

    Hi there, I am currently learning how to code php, having used asp.net for a few years I have decided to expand my horizons a bit with some php.

    I have started simple by converting a html site into php, however I have hit a small issue.

    The original site had a linked css stylesheet linked to it instead of inline styles. I have just switched all the <p> </p> tags to <?php echo " "; ?> however I do not know what to now call the tag in the stylesheet.

    Is it php, or echo, or php echo, or <?php ... HELP!

  2. #2
    Join Date
    Mar 2005
    Location
    Isle of Man
    Posts
    1,261
    Thanks
    3
    Thanked 23 Times in 23 Posts

    Default

    The HTML markup
    Code:
    <p> </p>
    and the PHP
    Code:
    <?php echo " "; ?>
    Are performing entirely different roles.

    PHP is an embedded scripting language, meaning that it can be interspersed with HTML markup, it is in no way a direct replacement for HTML markup.

    <?php is the opening tag tells the PHP interpreter that what is coming up is to be interpreted as PHP, rather than just left untouched. ?> is the closing tag, saying that, after this point leave the output alone.
    echo is a global PHP function that causes the subsequent argument to be output.

    Here are just a few examples, they achieve exactly the same result.
    //all HTML
    Code:
    <p>lorem ipsum</p>
    //All PHP
    Code:
    <?php
     echo "<p>lorem ipsum</p>";
    ?>
    //A mix of both
    Code:
    <p><?php echo "lorem ipsum"; ?></p>
    As you are ultimately creating an HTML web page, there is no special way to include a style sheet, you just construct the usual HTML markup.

    So, I'm not quite sure I understand where the misunderstanding is getting in, and I hope that somehow starts clearing up the mystery?

  3. #3
    Join Date
    Apr 2006
    Location
    Amsterdam
    Posts
    350
    Thanks
    20
    Thanked 11 Times in 11 Posts

    Default

    PHP is more like classic ASP I think, more or less a straight forward language. (I know, they are totally differently languages). asp.NET on the onther hand does have quite some functions that create HTML tags when using them.

    Hance the misunderstanding, I think.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. HTML Email Stationery
    By s80wkr in forum HTML/CSS/JavaScript
    Replies: 5
    Last Post: 30th December 2009, 12:27 AM
  2. index.html not loading
    By tom_vian in forum General Technical Support
    Replies: 1
    Last Post: 27th December 2006, 10:52 AM
  3. HTML to PHP
    By JamesU2002 in forum General Technical Support
    Replies: 4
    Last Post: 19th July 2006, 12:44 PM
  4. Converting plain characters to HTML
    By Rappie in forum Web Applications and Scripts
    Replies: 3
    Last Post: 13th June 2006, 08:46 PM
  5. Replies: 16
    Last Post: 2nd December 2005, 05:09 PM

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
  •