Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    262
    Thanks
    23
    Thanked 1 Time in 1 Post

    Post How to put a html block into a $var

    Good day,
    I was wondering how can I put a html block into a $var.

    Thanks!

  • #2
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    Is this what you're talking about?
    PHP Code:
    $html '<div>This is HTML</div>'

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You may also want to look into heredoc syntax.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #4
    New Coder
    Join Date
    Jul 2007
    Posts
    24
    Thanks
    1
    Thanked 0 Times in 0 Posts
    You can also try Output Buffering - something I use a lot, especially for those heavily templated websites.

    <?php ob_start(); ?>

    <p><strong>Hi there!</strong></p>
    <p>I hope this helps you</p>

    <?php $var = ob_get_contents(); ob_end_clean(); ?>
    <?php

    # manipulate $var here

    ?>

    http://au.php.net/ob_start


  •  

    Posting Permissions

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