Re: Couple of beginner questions
| From: | Nathan Rixham | Date: | Fri, 09 Jan 2009 17:39:28 +0000 |
| Subject: | Re: Couple of beginner questions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-285869@lists.php.net to get a copy of this message | ||
Gary wrote:
I've done a number of sites in html and am now venturing into php. Can I create a page in html and insert php code that will work? (for example, take an existing page and insert a date command)if it has the file extension .php then it will be passed through php and compiled; otherwise the php source code you insert will just show up in the html source.
Can I create a page with the php extension that contains only contains html and no php? If so are there advantages/disadvantages?yep; advantage is if you later add in some php to the page it'll compile (see above)
Can I mix and match file formats (php/html) in a single site?yep, every file is a different file
Thanks for any input. Garynp; you may get some comments about being able to configure you're server so that php parses files with different extensions (such as .html); but this would require some customisation of the web server config files and probably best avoided for now. note: sometimes it is worth always having each script/html page in it's own directory with the default file name; that way you can upgrade chop and change without changing the page urls - ie: if you make /contact/index.html or /contact/index.php then the url /contact/ will show the default index page, allowing you to swap and change whereas if you have /contact.html then you'll need to rename the file to contact.php and thus you're urls will change unnessacerily. ps: wd for choosing php :)