140 likes | 303 Views
IntroductionToPHP. Static vs. Dynamic websites A static website is created using HTML pages which have been written in a fixed way to instruct the browser how to render the page. (What you see it what you get). Static websites are used to display fixed information which most often does not need
E N D
IntroductionToPHP Staticvs.Dynamicwebsites AstaticwebsiteiscreatedusingHTMLpageswhichhavebeenwritteninafixedway toinstructthebrowserhowtorenderthepage.(Whatyouseeitwhatyouget). Staticwebsitesareusedtodisplayfixedinformationwhichmostoftendoesnotneed tobeupdatedonaregularbasis. AstheWebevolved,sitesbecamemorecomplexandwereexpectedtodisplay dynamicinformationwhichcouldnothavebeen“hardcoded”inHTML. Such as: Searchresults Numberofvisitors Userlogin Messageboards
IntroductionToPHP Dynamicwebsites ThesolutionwastogeneratetheHTML“on-the-fly”basedonparametersand specifications. Forexample,Ifauseraskstoseesearchresults,auniquepagewouldbegenerated specificallyforhim. TheuserwouldgetanHTMLpage,butanHTMLpagethatwastailoredmadefor him. Sincethereisnowayofknowingeverypossiblesearchresultforeverypossiblekey word,thefinalpageisbeingassembledusingaserver-sidescript. Theserver-sidescriptconstructsthepageandthenitisbeingsentbacktotheclient. Thismeanthatthepageresult.htmlwilllookdifferenteachtimebasedonthegiven specifications.
IntroductionToPHP Dynamicwebsites Everyclientmakesarequestforapage. Theservercheckswhattheclienthasaskedforandbasedonthatconstructsapage forhimbasedonanexistingtemplate. ThetemplateisapagewhichcontainsHTMLcodeandserver-sidecodethatwillend upasHTMLcodeaswell,butadifferentHTMLeachtime.
IntroductionToPHP ThreeTierWebApplications
IntroductionToPHP BenefitsOfDynamicContent Theabilitytocustomizepagesforanygivenuser. Greatereaseofmodificationandupdate. Extendedfunctionality(login,transactions,communicationetc.). Automatingthesiteandallowingittosupportitself.Lesspagestomanuallycreate.
IntroductionToPHP Server-SideScripting Inordertogeneratedynamicpagesweuseaserver-sidescriptinglanguage. Therearedifferenttypesofserver-sidescriptinglanguagessuchasPHP,ASP, ASP.NET,ColdFusion,JavaServerPages,Perlandothers. Eachscriptinglanguagesisbeinginterpretedbyanapplication,justasFlashisused tomakesenseofActionScriptandhavethecodedothings. Theapplicationwhichinterpretstheserver-sidescriptisinstalledontheseverjustlike anyotherapplication.
IntroductionToPHP Server-SideScripting Server-sidescriptinglanguagesarealsooperatingsystemsdependent. PHPforexampleisbeinginterpretedbyanapplicationcalledApachewhichrunsona UNIXoperatingsystem. Eachserver-sidescriptinglanguagessupportsbasicprogrammingconceptssuchas variables,arrays,functions,loops,conditionalstatementandothers. Theyalsocontainmorespecificelementssuchasspecialobjects,commandsusedto communicatewiththeserverandadatabaseandmuchmore.
IntroductionToPHP Server-SideScripting&Databases Whenthereisaneedtostoreandretrieveinformation(usernames,itemsinstock etc.)adatabasewillbeusedtocontainthedata. Sever-sidescriptcancommunicatetoadatabaseusingastructuredquerylanguage (SQL)whichmanipulatesthedatabase(add,remove,updateetc.) Moreonthatnextweek.
IntroductionToPHP WhatisPHP? PHPstandsforPHP:HypertextPreprocessor PHPisaserver-sidescriptinglanguage,likeASP PHPscriptsareexecutedontheserver PHPsupportsmanydatabases(MySQL,Informix,Oracle,Sybase,Solid, PostgreSQL,GenericODBC,etc.) PHPisanopensourcesoftware(OSS) Thismeansitsfreetouseandisnʼtbeingcontrolledbyasingleentity. Itisbeingdevelopedbyagroupofdevelopers PHPsyntaxresemblesthatofJavaScriptandActionScriptindifferentways. PHPisfreetodownloadanduse
IntroductionToPHP WhatisPHP? PHPstandsforPHP:HypertextPreprocessor PHPisaserver-sidescriptinglanguage,likeASP PHPscriptsareexecutedontheserver PHPsupportsmanydatabases(MySQL,Informix,Oracle,Sybase,Solid, PostgreSQL,GenericODBC,etc.) PHPisanopensourcesoftware(OSS) Thismeansitsfreetouseandisnʼtbeingcontrolledbyasingleentity. Itisbeingdevelopedbyagroupofdevelopers PHPsyntaxresemblesthatofJavaScriptandActionScriptindifferentways. PHPisfreetodownloadanduse
IntroductionToPHP WhatisPHP? PHPfilesmaycontaintext,HTMLtagsandscripts. PHPfilesarereturnedtothebrowserasplainHTML. PHPfileshaveafileextensionof".php",".php3",or".phtml". PHPcanbewritteninanytexteditor. PHPscriptwillbelocatedinsidespecialtags,muchlikeJavaScript e.g.<?php//phpscripthere?> PHPcodecanbelocatedanywhereinthepage. PHPiscasesensitive. EveryvariableinPHPwillhavethe$symbolasaprefix e.g.$myName=“John”; EverylineofcodeMUSTbeterminatedwitha;symbol.
IntroductionToPHP WhatisMySQL? MySQLisasmalldatabaseserver MySQLisidealforsmallandmediumapplications MySQLsupportsstandardSQL MySQLcompilesonanumberofplatforms MySQLisfreetodownloadanduse PHP+MySQL PHPcombinedwithMySQLiscross-platform (meansthatyoucandevelopinWindowsandserveonaUnixplatform).
IntroductionToPHP WhyPHP? PHPrunsondifferentplatforms(Windows,Linux,Unix,etc.) PHPiscompatiblewithalmostallserversusedtoday(Apache,IIS,etc.) PHPisFREEtodownloadfromtheofficialPHPresource:www.php.net PHPiseasytolearnandrunsefficientlyontheserverside
IntroductionToPHP WhatdoYouNeed? Hosting-www.media72.co.uk Youcanuseanyhostingcompanyyouchoose,buttheymusthaveatleast: 1SQLdatabase&PHP CodeEditor-www.panic.com/coda Abilitytotestlocally-www.mamp.info