Jump to content

Newbish question


Stickybomb

Recommended Posts

Hi i have been using php for several monsths now and I think it rocks.

how ever i was wondering when your echoing html with php how you can get it to display it cleaner like tab and organized like it was coded that way. I tried using the /n new line but it just displays the text? ???

can some on please help me with this thxs  :)
Link to comment
Share on other sites

Example.

[code]
<?php
  echo "<html>\n";
  echo "  <head>\n";
  echo "    <title>foo</title>\n";
  echo "  <head>\n";
  echo "  <body>\n";
  echo "    <p>this is a paragraph</p>\n";
  echo "  </body>\n";
  echo "</html>\n";
?>[/code]
Link to comment
Share on other sites

no i know the whole /n new line code, sorry if I was unclear I was wondering if there was another way of doing the same sort of thing. the /n does not always work in every situation, and i tend to be very neat and picky when it comes to my code so I am looking for the most control over how it outputs it.
Link to comment
Share on other sites

The \n not /n does work when within double quotes. I'm a little lost as to what your question really is. Are you asking how to make newlines in html source or in html output? A new line in html is <br /> as jesirose pointed out. Otherwise, you'll need to explain your question better.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.