Jump to content


Photo

Shtml vs PHP Includes


  • Please log in to reply
6 replies to this topic

#1 Conjurer

Conjurer
  • Members
  • PipPipPip
  • Advanced Member
  • 107 posts

Posted 08 August 2006 - 06:22 PM

Is there a difference? 

If you have access to php on your hosting site when and why would it make since to use an shtml include instead of a PHP include?



#2 bltesar

bltesar
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 08 August 2006 - 06:33 PM

how do shtml includes work? 

Obviously, a only a PHP include can have PHP code and dynamically generated content, but if only static HTML is needed, perhaps the shtml include is faster and uses less server resources.

#3 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 08 August 2006 - 06:37 PM

php is dynamic - you can use certain information either submitted by a client or drawing database records etc. etc.

shtml and server side includes are simply that. They cant be dynamic like php. the only thing you could do is include certain pages on certain pages but they will always look the same.
follow me on twitter @PHPsycho

#4 Conjurer

Conjurer
  • Members
  • PipPipPip
  • Advanced Member
  • 107 posts

Posted 08 August 2006 - 06:40 PM

So if you can do it with PHP is there a reason trying to learn to do it with SHTML

Are there any situations where an SHTML include would be preferred to PHP - given your server can process both?



#5 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 08 August 2006 - 06:57 PM

you could use shtml to include something that NEVER changes (unless you alter the file you are including).

use php if you want this particluar element to beable to show different content - content that may change daily or content created randomly from the information you have provided in that file.
follow me on twitter @PHPsycho

#6 Conjurer

Conjurer
  • Members
  • PipPipPip
  • Advanced Member
  • 107 posts

Posted 08 August 2006 - 07:06 PM

Ok, I get that part, but is there an advantage to using SHTML when it does the job?

#7 bpops

bpops
  • Members
  • PipPipPip
  • Advanced Member
  • 232 posts

Posted 08 August 2006 - 08:07 PM

Like bltesar said, it might use fewer system resources. I've defenitely used some servers in the past that are a tad slow with php, and if I was writing something static, i always preferred shtml over includes.

The habit has stayed with me now, and I have a main site logo with a menu that is included() on php pages where I have dynamic stuff going on, but is incorporated with shtml on pages that don't change, like FAQs, LINKS, etc.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users