Skip to content Skip to sidebar Skip to footer

Frames With Php

Can I use HTML Frames with PHP? I presumed I can do this by..

Solution 1:

You can use PHP with HTML framesets, but you shouldn't be outputting anything in a <body> element of a frameset page (even then it should be <noframes>, not <body>). Content goes within the individual pages contained by your <frame /> elements.

Anyway, don't use frames. PHP as a templating language is meant to help you separate components of your pages by way of includes, rendering framesets completely unnecessary in the first place.

Solution 2:

Yes, you can use frames. But you'll have to output the actual content in the frameset files, in your case limits.php. Beware of a few things here:

  • Starting the session in the frameset file is ok.
  • But you'll also have to session_start() in the limits.php frame content file.
  • Likewise the HTTP authentication should be performed in all frame files.
  • Do not assume that people cannot access do_menu3.php directly.

I've previously used frames for implementing a NortonCommand-clone for the web, where it's more senseful than CSS-arranging divs. However, handling jQuery is more cumbersome with frames. In regards to PHP it's as simple as treating every frame script as individual entry script.

Post a Comment for "Frames With Php"