Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
ACM 365 WEEK -1 ACM 365 Course Notes Web Development Environment Authoring Web pages is not a particularly difficult task now-a-days. Many standard desktop software packages come equipped with built-in features to convert word processing documents, spreadsheets, databases, and the like to coded documents that are ready for access across the Web. Special Web page authoring packages such as Microsoft FrontPage and Adobe Dreamweaver permit creation of Web pages with dragand-drop ease. In most of these cases it is not even necessary to know or to be aware of the special HTML(HyperText Markup Language) coding that takes place behind the scenes. If you know the XHTML language, then you can author your Web pages with a simple text editor, usually gaining a great deal more control over their structure and formatting than is possible with drag-and-drop methods. In addition, you have the ability to easily integrate existing XHTML code, Java applets, multimedia plug-ins, and browser scripting languages to bring a modicum of user interactively to your pages. ACM 365 Course Notes Web Development Environment Web "development," as contrasted with Web page "authoring," goes well beyond the use of markup codes and a few plug-ins or scripting techniques to make attractive and informative Web pages. The term pertains to the use of special strategies, tools, and methods for producing Web pages and Web sites characterized as three-tier, client/server, and information processing systems. Web technologies are used to produce not just simple personal or promotional Web sites containing informative, interesting, or entertaining material for public consumption. Rather, they are becoming important means for supporting the foundational "business processes" of modern organizations -- the underlying operational and management-support functions. The technical infrastructures for supporting these purposes are roughly classified into three types of Web-based systems, termed: intranets , internets, and extranets. ACM 365 Course Notes Web Development Environment ACM 365 Course Notes Information Processing Model The input function permits users to interact with the system, requesting processing options, controlling information access, and specifying delivery methods. Plus, the user can become the source of the data which the system processes and which it maintains in its repositories of stored information. The processing function refers to the data manipulation activities and the processing logic needed to carry out the work of the system. The term implies that the system can be "programmed" to perform the arithmetic and logical operations necessary to manipulate input data and to produce output information. The output function delivers the results of processing to the user in a correct, timely, and appropriately formatted fashion. The storage function ensures the currency and integrity of processed information, maintaining it over the long term and permitting it to be added to, changed, or deleted in systematic fashion. In the final analysis, stored information becomes the primary content of Web pages. ACM 365 Course Notes PHP http://www.maconstateit.net/tutorials/PHP/default.htm ACM 365 Course Notes PHP XML tag style <?php PHP Code Block ?> Short style <? PHP Code Block ?> Tag style <script language="php"> PHP Code Block </script> ACM 365 Course Notes Mixing HTML and PHP ACM 365 Course Notes Mixing HTML and PHP XHTML 1.1 Conformance The Web page should indicate with which set of standards it is in conformance. A Web page denotes its conformance standard with a Document Type Definition (DTD) coded at the top of the page, following the XML declaration. Since the primary conformance standard followed in these tutorials is XHTML 1.1, the conformance DTD is coded as follows. The <html> Root Element Finally, the root element (the opening tag) of an XHTML page should be an <html> tag indicating the namespace of the applicable standard, that is, the Web location of the XHTML standard being applied to the page. ACM 365 Course Notes Displaying Content The echo and print statements appear in the following format: echo - used to output one or more strings. echo "Text to be displayed" print - used to output a string. In some cases the print statement offers greater functionality than the echo statement. These will be discussed in later tutorials. For now print can be considered an alias for echo. print "Text to be displayed“ With both the echo and print statements, it is necessary to use a <p> or <br/> tag to create paragraphs or line breaks. ACM 365 Course Notes Displaying Content ACM 365 Course Notes Instruction Terminator ACM 365 Course Notes Commenting your code // - simple PHP comment # - alternative simple PHP comment /*...*/ - multi-line comment blocks. Comments are ignored by the PHP parser. ACM 365 Course Notes Commenting your code ACM 365 Course Notes Scalar Variables Variables are temporary place holders used to represent values used in a PHP script. PHP includes two main types of variables: scalar and array. Scalar variables contain only one value at a time , and array variables contain a list of values. PHP scalar variables contain the following types: Integers - whole numbers or numbers without decimals. (1, 999, 325812841) Floating-point numbers (also known as floats or doubles) Numbers that contain decimals. (1.11, 2.5, .44) Strings - text or numeric information. String data is always specified with quotes ("Hello World", "478-477-5555") Boolean - used for true or false values PHP variables of all types begin with the "$" sign. Variable names can contain letters, numbers, and the (_) underscore character. Variables cannot, however, begin with numbers. In PHP variable names are case sensitive. ACM 365 Course Notes Scalar Variables Legal Variable Names $myvar $F_Name $address1 $my_string_variable Illegal Variable Names Myvar $1stvar $&62## $username = "jdoe" $first_name = "John" $Last_Name = "Doe" ACM 365 Course Notes Scalar Variables ACM 365 Course Notes Scalar Variables ACM 365 Course Notes Scalar Variables Variable Concatenation The dot operator can also be used to join strings and variables ACM 365 Course Notes Scalar Variables Interpolation PHP also supports a process known as interpolation - replacing a variable with its contents within a string. ACM 365 Course Notes Scalar Variables Formatting currency output ACM 365 Course Notes Scalar Variables Sprintf (http://php.net/manual/en/function.sprintf.php) ACM 365 Course Notes Array Variables While a PHP scalar variable stores a single value, an array variable can be used to store a set or sequence of values. PHP supports numerically indexed arrays and associative arrays. An array in PHP is actually an ordered map. A map is a type that maps values to keys. Array variables consist of two parts - an index and an element. The array index, sometimes referred to as the array key, is a value used to identify or access array elements. The array index is placed in square brackets. Most arrays use numeric indices that typically start with 0 or 1. In PHP associative arrays can use string indices. Both types of arrays are created using the array() construct. ACM 365 Course Notes Array Variables Numerically Indexed Arrays $my_array = array('red', 'green', 'blue') This code creates a numerically indexed array called $my_array. The array is assigned three elements - red, green, and blue. Each element is identified by a numeric index. $my_array[0] = 'red' //index 0 corresponds to element red $my_array[1] = 'green' // index 1 corresponds to element green $my_array[2] = 'blue' // index 2 corresponds to element blue ACM 365 Course Notes Array Variables ACM 365 Course Notes Array Variables Associative Arrays Associative arrays allow you to use more useful index values. With numerically indexed arrays, index values are created automatically beginning with 0. Associative arrays permit numeric and string index values. The symbol between the index and values (=>) is an equal sign immediately followed by a greater than symbol. $members = array('FName' => John, 'LName' => Smith, 'Age' => 50) In this example, the array members contain three elements, however the string indices - FName, LName, and Age are used. $members['FName'] = 'John' //index FName corresponds to element John $members['LName'] = 'Smith' // index LName corresponds to element Smith $members['Age'] = '50' // index Age corresponds to element 50 ACM 365 Course Notes Array Variables ACM 365 Course Notes Array Variables Array Functions count() - the count function is used to count the number of elements in an array. sort() - the sort function is used to sort the elements of an existing array. shuffle() - the shuffle function is used to randomize the elements of a given array. sizeof() - the sizeof function is an alias of the count() function. array_slice($array_name,offset, length) - the array_slice function is used to extract a chuck of an existing array.$array_name is the name of the array to slice, offset denotes the position where the slice will begin, length indicates the number of elements that will be sliced from the array. array_merge($array_name, $array_name) - the array_merge function is used to combine or merge two or more existing arrays. The names of the arrays are separated by commas. ACM 365 Course Notes Array Variables ACM 365 Course Notes Constants A constant, like a variable, is a temporary placeholder in memory that holds a value. Unlike variables, the value of a constant never changes. When a constant is declared, the define() function is used and requires the name of the constant and the value you want to give the constant. Constants can be assigned the following types of data: Integers - whole numbers or numbers without decimals. (1, 999, 325812841) Floating-point numbers (also known as floats or doubles) - Numbers that contain decimals. (1.11, 2.5, .44) Strings - text or numeric information. String data is always specified with quotes ("Hello World", "478-477-5555") ACM 365 Course Notes Constants PHP constants unlike variables do not begin with the "$" sign. Constant names are usually uppercase. Constant names can contain letters, numbers, and the (_) underscore character. Constants cannot, however, begin with numbers. Declaring constants is demonstrated below: define("STRING_CONSTANT", "This is my string."); define("NUMERIC_CONSTANT", 5); ACM 365 Course Notes Constants ACM 365 Course Notes Operators 3 examples ACM 365 Course Notes Operators ACM 365 Course Notes Operators ACM 365 Course Notes Operators ACM 365 Course Notes Strings Single Quoted Strings Single quotes provide the easiest method for working with strings. Using this method, strings are surrounded by single quotes (''). If single quotes are needed as part of the display, they must be escaped with the backslash ("\") character. While single quotes provide an easy method for working with strings, single quotes do not support the use of interpolation. Double Quoted Strings PHP strings can also be displayed using double quotes (""). If PHP strings are enclosed in double quotes, it is possible to take advantage of interpolation. With double quoted strings, PHP also supports more escape characters ACM 365 Course Notes Strings ACM 365 Course Notes Strings ACM 365 Course Notes Strings strlen(string) - determines the length of a string. ltrim(string) - strips whitespace from the beginning of a string. rtrim(string) - strips whitespace from the end of a string. strpbrk(string, char) - Searchs the string for the character (char). Returns false or string beginning with the character found. strtoupper(string) - converts string to uppercase. strtolower(string) - converts string to lowercase. strrev(string) - reverses a string. eregi(string pattern, string subject) - Performs a case insensitive expression match. Searches subject for a match to the regular expression given in pattern. ACM 365 Course Notes Strings ACM 365 Course Notes Date/Time date(format) - Returns the current server time, formatted according to a given set of parameters. checkdate(month, day, year) - Validates a given date. Successful validation means that the year is between 0 and 32767, the month is between 1 and 12, and the proper number of days in each month. time() - Returns the current server time, measured in seconds since the Epoch or January 1, 1970. ACM 365 Course Notes Date/Time ACM 365 Course Notes Date/Time http://php.net/manual/en/function.date.php ACM 365 Course Notes