PDA

View Full Version : Html Vs Php



BawA
05-02-2004, 07:52 AM
what is diffrent between them, which is better.
ma site is html should i convert to PHP? :helpsmile:

vivitron 15
05-02-2004, 09:03 AM
they are basically one and the same - php is just "dynamic html" take this eg:

you have a photo gallery on your page
html - when you add a photo, you upload the picture, edit the html such that the picture is included and hyperlinked to
php - you make a script which goes through a certain directory, lists all the files and then displays all the images with all links etc. automatically.

you have a menu bar on 10 of your pages which allows people to navigate the site.
html - when you add a page, you must edit each html page seperately, adding the new page
php - you put the code for the menu in a seperate file "menucode.inc.php" then in each page, you add the code "<? include("menucode.inc.php"); ?> When you want to add a page, all you need do is to change that 1 file, and all are updated.



php doesnt take long to learn enough to get your page easier to maintain, and if your host allows it, then id say go ahead - for a start, just rename all the files from index.html to index.php and itll work just the same.

Oh, and when you start getting errors after having used some php code, check you included a ";" at the end of each line and that you closed all the brackets ;)

BawA
05-02-2004, 09:06 AM
Thanks, that help me lot ;)

BawA
05-02-2004, 09:23 AM
the hardest part is that i must relink all pages :(

TRshady
05-02-2004, 10:38 AM
In that case I suggest you get dreamweaver bawa mate. You can change source code in all your pages in the entire current local site. Meaning you could just type in to change .html to .php, and its all done for you. Plus all the other benefits you get with dreamweaver .......

BawA
05-02-2004, 10:46 AM
i have dreamweaver but the "source" thing, i didnt understand can u tell step to do that.
i took me 1 Hr to change all html&#39;s to php :lol:

TRshady
05-02-2004, 11:28 AM
lol, poor sod .. dont have dreamweaver on this comp .. so I&#39;ll do ma best to tell you from memory.

1. First make sure the results panel is open, if not then window>results
2. Click on the search tab and when the box open, change &#39;current document&#39; to &#39;entire current local site&#39;
(I assume you have set up a site for use with this project?)

3. Now change text to source code
(this will make dreamweaver search and edit the source, not the actual text on pages so wont modify your content).

4. Now theres to boxes, one for what to look for, and what to change it too ...
Now although you want to change index.html to index.php, using filenames here will mean you will need to do them all. I know you&#39;ve done this already, but now you know what to do next time eh?

5. In the first box type: .html ... in the second type .php
(so this will search through the coding of all your pages, and change every instance of .html to .php which is what you want). Oh, but be careful as if you have used the text .html on any of your pages, this will be changed to .html.

vivitron 15
05-02-2004, 04:23 PM
i do believe when you rename pages using the "site managment" bit (where you upload files from) it will ask "update links to this page in the current site?" click Yes, and itll do it for ya i think


but thats for anyone else trying to do it - too late to help you ;)

I.am
05-02-2004, 10:45 PM
PHP is a server side scripting language & HTML is on client side. Only use php if you are using to run scripts that would be suitable at client side or using a database to explode the content to your pages created dynamically.

Btw, :P vivitron those examples you gave can all be done without php. Regarding menu bar, one can use .shtml and include it on all the pages as a header or footer. &#60;&#33;--#include virtual="LOCATION_OF_FILE"--&#62;

I would recommend using PHP only if you are doing any server side scripting.

<offtopic>
Its hilarious the other day I saw someone using php and it was a disgrace to php. That guy named all his pages as page.php and inside he was including header, footer, and sidebar pages which were all in html. Everything is html but he used php just to impress people and including html pages which could have been achieved by several other methods. I guess I am gonna rip him apart pretty soon in a presentation :lol: </offtopic>

-
I.am