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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2010
    Location
    London
    Posts
    339
    Thanks
    63
    Thanked 11 Times in 11 Posts

    Positioning within HTML?

    Hi there.

    I have a search page with a huge chunk of php that makes it all work. I've managed to group most of the php together and currently have it all sitting in the <head> of the document. Is this the best place for it? I'm going to put in a sperate file and use an 'include' just for tidyness sake when looking at my html.

    I'm assuming it doesn't really matter? Performance wise?

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    No, performance wise, it doesn't matter, as PHP pages are first parsed by the PHP parser, line by line. So if its at the top, it'll get processed first, then the rest is read, posted later, and it reads the beginning first then processes. Its the efficiency of your code that makes a difference.

    I, for example, like to put any processing I can at the top of the page, avoiding any double looping by putting any loops wherever they belong, etc.

  • Users who have thanked Keleth for this post:

    paddyfields (07-19-2012)

  • #3
    Regular Coder
    Join Date
    Dec 2010
    Location
    London
    Posts
    339
    Thanks
    63
    Thanked 11 Times in 11 Posts
    Cool, thank you.


  •  

    Posting Permissions

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