Presentation is loading. Please wait.

Presentation is loading. Please wait.

CREATED BY : VIRAL M.KORADIYA. Anchor elements are defined by the element. The element accepts several attributes, but either the Name or HREF attribute.

Similar presentations


Presentation on theme: "CREATED BY : VIRAL M.KORADIYA. Anchor elements are defined by the element. The element accepts several attributes, but either the Name or HREF attribute."— Presentation transcript:

1 CREATED BY : VIRAL M.KORADIYA

2 Anchor elements are defined by the element. The element accepts several attributes, but either the Name or HREF attribute is required.

3 Attribute HREF NAME TARGET

4 The href Attribute if the HREF (Hypertext Reference) attribute is present, the text between the opening and closing anchor elements becomes a hypertext link. Example: link

5 The target Attribute The target attribute defines where the linked document will be opened. Example: Visit Google!

6 The name Attribute When the name attribute is used, the element defines a named anchor inside a HTML document. Named anchor are not displayed in any special way. They are invisible to the reader. Named anchor syntax: Any content The link syntax to a named anchor: Any content

7 Example: A named anchor inside an HTML document: Useful Tips Section A link to the Useful Tips Section from the same document: Jump to the Useful Tips Section

8 Line Breaks The line break element specifies that a new line must be started at the given point.

9 A horizontal rule( ) element is a divider between sections of text, such as a full-width horizontal rule or a similar graphic. Attribute:

10

11

12 Document Tag comment

13 Body Tag Attribute  bgcolor Example  Text Example

14 Comment Example of comment hello

15 Text Formatting Tag to

16

17 to HTML defines six levels of heading

18 The paragraph element indicates a paragraph of text. To align paragraph use ALIGN =left/right/center attribute and values have been added to the element.

19 The preformatted text element presents blocks of text in fixed-width font and is suitable for text that has been formatted on-screen or in a mono-spaced font.

20 This tag is specified text should be bold This tag is specified text should be underline.

21 This tag is specified text should be Italic style. The TeleType element specified that the text be rendered in fixed-width typewriter font where available.

22 The element states that the enclosed text should be displayed with a horizontal line striking through the text.

23 The element specifies that the enclosed text should be displayed as a subscript. The element specifies that the enclosed text should be displayed as a superscript.

24 The element specifies that the enclosed text should be displayed, if practical, using a big font compared with the current font.

25 The strong element can be used to indicate strong typographic. The element specifies that the enclosed text should be displayed, if practical, using a small font compared with current font.

26 The tag specifies a default address or a default target for all links on a page. The tag goes inside the head element. Attribute :-HREF Example:

27 Microsoft internet explorer support different-sized fonts within HTML documents. The element is. Valid values range from 1 to 7. the default font size is 3.

28 Font attributes Size : 1 to 7 Color : color name & #rrggbb The color attribute sets the color that text appears on screen. #rrggbb is a hexadecimal color denoting an RGB color values. Face : name The face attribute sets the typeface used to display the text on-screen. The typeface displayed already must be installed on the user’s computer.

29 Example hello or hello or hello  hello

30 The tag specifies a default font-color, font- size, or font-family for all the text in a document. Example:

31 Surrounding any text with this element causes the selected text to blink on the viewing page. This can add extra emphasis to selected text. Example this text blink on the page Note: the … element currently is supported only by Netscape browser.

32 The element allows you to create a region of text that can be made to scroll across the screen. Example: Hello student

33 Attributes Align This attribute can be set to TOP,MIDDLE and BOTTOM specifies that the text around the marquee should align with the top, middle and bottom of the marquee. Example: hello

34 Behavior This can be set to SCROLL, SLIDE and ALTERNATE. It specifies how the text displayed in the marquee should behave. Example: hello

35 Direction This specifies in which direction the text should scroll. The default is LEFT. Which means that the text will scroll to the left from the right-hand side of the marquee. This attribute also set to RIGHT, which causes the marquee text to scroll from the left to the right. Example: hello

36 Frames With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and each frame is independent of the others. The disadvantages of using frames are: The web developer must keep track of more HTML documents It is difficult to print the entire page

37 The Frameset Tag The tag defines how to divide the window into frames Each frameset defines a set of rows or columns The values of the rows/columns indicate the amount of screen area each row/column will occupy

38 The Frame Tag The tag defines what HTML document to put into each frame

39 In the example below we have a frameset with two columns. The first column is set to 25% of the width of the browser window. The second column is set to 75% of the width of the browser window. The HTML document "frame_a.htm" is put into the first column, and the HTML document "frame_b.htm" is put into the second column:

40 Tag Definition and Usage The tag defines a frameset. The frameset element holds two or more frame elements. Each frame element holds a separate document. The frameset element states only how many columns or rows there will be in the frameset.

41 Example A simple three-framed page:

42 Attributes COLS = PIXELS OR PERCENTAGE Specifies the number and size of columns in a frameset ROWS = PIXELS OR PERCENTAGE Specifies the number and size of rows in a frameset

43 Vertical Frame

44 Horizontal Frame

45 …….. …… ………

46 The tag embeds an image in an HTML page. Notice that images are not technically inserted into an HTML page, images are linked to HTML pages. The tag creates a holding space for the referenced image. The tag has two required attributes: src and alt.

47 Required Attributes Attribute Value Description alt text Specifies an alternate text for an image src URL Specifies the URL of an image

48 Example:

49 Optional Attributes Align : Use styles instead Specifies the alignment of an image according to surrounding elements Values : left,right

50 Border: Specifies the width of the border around an image Value: pixels Height : Specifies the height of an image Value: pixels % Width :Specifies the width of an image Value : pixels %

51 vspace: Specifies the whitespace on top and bottom of an image Value: pixel hspace: Specifies the whitespace on left and right side of an image Value : pixel

52 Example: <img src="D:\image3.jpg" width=250 height=500 > <img src="D:\image4.jpg" hspace="200“ vspace="1000">

53

54 Table HTML Elements are: ……………. ………… ………………….

55 TABLE ATTRIBUTE: ALIGN =LEFT, RIGHT, CENTER BGCOLOR=“#RRGGBB /COLORNAME” BORDER =VALUE BORDERCOLOR=“#RRGGBB /COLORNAME” CELLPANDDING=VALUE CELLSPACING=VALUE HEIGHT= PERCENT WIDTH= PERCENT BACKGROUND= IMAGE

56 CAPTION ATTRIBUTES ALIGN ATTRIBUTE ALIGN=LEFT ALIGN=RIGHT ALIGN=CENTER ALIGN=TOP ALIGN=BOTTOM

57 ,, ATTRIBUTES ALIGN=LEFT / RIGHT / CENTER BACKGROUND=IMAGE BGCOLOR=“#RRGGBB”/COLORNAME BORDERCOLOR =“#RRGGBB”/COLORNAME COLSPAN=VALUE ROWSPAN=VALUE HEIGHT=PERCENT WIDTH=PERCENT NOWRAP

58 PHP Programming

59 Topics Background and History of PHP Installation Comments in PHP Variables Conditions Loops Functions File Handling Database Handling (MySQL, MSSQL, ODBC)

60 Background Personal Home Page – C kind of scripts written in Perl language, by Rasmus Lerdorf in 1995. He called the language as PHP/FI – Personal Home Page / Forms Interpreter. 1997 Version 2.0 was released Then came 3.0, 4.0. They were called PHP simply Recent version is PHP 5.2.3

61 Installation Apache server need to be installed first The config file for apache server will be present in the conf folder under the apache installed directory Set the DocumentRoot to the path where the PHP files will be stored Install PHP. Point apache conf directory when it asks so and select the appropriate web server. Move the PHP.ini file to C:\WNDOWS directory

62 PHP Comments All php files are saved with extension.php The can be written in notepad or any text editor Single line comment // this is single line comment Multi line comment /*…. This is a multi line comment */

63 Sample PHP The above program will display hello in the browser

64 Variables Variables start with a $ symbol Variables can contain _ or numbers or alphabets $ should be followed by _ or alphabet and not by a number PHP is loosely typed language. There is no strict data typing Variable can be assigned with any values

65 Conditions If else if(condn) {….} elseif(condn) {….} else { ….} Switch case switch(var) { case c1: statements;break. Default: statements; break; }

66 Loops For for(intialisation;condition;increment/decrement) { statements } While while(condn) { ….} Do While do {….} while(condn);

67 Functions and Parameters PHP functions need to be defined with key word function It can have zero or more values (parameters) Functions may or may not return values If a function need to return value, the last statement of the function should be return return value;

68 Functions Parameter less function <?php function sayHi() { echo “hi”; } ?> This can be called as in the program

69 Functions Parameterized function <?php function greet($name) { echo “Hello “. $name; } ?> This can be called This gives an output Hello Ram

70 Functions Function returning value <?php function add($a,$b) { return ($a + $b); } ?> When called like we will get an output 3 in the browser.

71 File Handling This involves 5 tasks Opening a file Reading data from a file Displaying the read data Writing contents to another file Closing a file

72 Opening a file $fp = fopen(‘filename’,’mode’); Eg $fp = fopen(‘c:\abc.txt’,’r’); This opens a file abc.txt in read only mode Available modes: r – read only w – write only w+ - read write A – append – adding to the end

73 Reading a file Several methods are available fread(filepointer,no of bytes to read) fgetc(filepointer) – Reads character by character fgets(filepointer) – Reads line by line The read content can be stored in a variable $data = fread($fp,10) – this reads 10 characters from file pointed by file pointer $fp and stores in $data If we want to read characters till end, we need to use a loop with condition checking for End of File

74 Writing to file We can use echo $data, to print the contents read from the file to browser Or we can open another file in write mode and put the contents to that file using either of these methods fwrite(filepoiner,data); fputc(filepointer,char); - writes character by character fputs(filepointer,line); - writes line by line Eg - fwrite($fpw,$data);

75 Closing a file feof(fp) – Checks for end of file. Returns –1 if EOF is reached. Otherwise returns 0 To close a file use fclose(filepointer) method Eg. fclose($fp); This closes the file pointed by $fp.

76 Database Handling PHP can connect to MySQL MSSQL Access and other databases like oracle, postgre sql etc There are separate methods available for connecting to the databases

77 MySQL and MSSQL Connection mysql_connect(dbserver,userid,password) mssql_connect(dbserver,userid,password) These methods are used for connecting to MySQL and MSSQL server using a userid and password $con = mysql_connect(‘localhost’,’root’,’root’); This gets a connection to the local mysql server using the credentials root and root If server cannot be connected, it will throw an error stating the problem Note: Mysql and MSSQL can be accessed in identical way except for the preceeding mysql or mssql. So will use mysql henceforth.

78 MySQL Select DB mysql_select_db(connection,dbname) mysql_select_db($con,”test”); This will select the db test under the server localhost If unable to select the database, an error will be thrown

79 MySQL Execute Query mysql_query(connection,sql statement); This will execute the sql statement on the database and store the result in a variable Eg $rs = mysql_query($con,select stmt); The rows of select statement will be stored in $rs $row = mysql_fetch_array($rs); This will fetch a row and store in $row Values can be accessed like - $row[“ID”] – returns value of column ID in the fetched row.

80 MySQL and MSSQL Close To close a db connection we have close method mysql_close(connection); mssql_close(connection); Example mysql_close($con); mssql_close($con);

81 ODBC Data handling Connect to a data source odbc_connect(dsn,uname,pwd); DSN – Data Source Name Go to Control Panel -> Administrative Tools -> Datasources (ODBC) Click on ODBC and select System DSN tab. Click Add and choose Access Database (mdb) and click Finish In the dialog that appears, give DSN Name and Description

82 ODBC Data handling Contd.. Click on Select under Database section Choose a mdb (access database file) and give OK $conn=odbc_connect('nwind','',''); Here nwind is the DSN that we have created in our system to access a database We have not given any user name or password during DSN creation So those fields are left empty.

83 Selecting rows from a table $rs = odbc_exec($conn,$sql); $conn – connection string $sql – SQL query to select rows from table $rs is the result set of the query execution odbc_fetch_row($rs) This command fetches row by row from the result set $cid = odbc_result($rs,"CustomerID"); This command fetches value for the column CustomerID from the current row and stores it in the variable $cid.

84 Closing Connection odbc_close(connection) This function closes the connection obtained and releases the same to the connection pool odbc_close($conn); The connection defined by $conn is released and no query can be executed using this connection variable hence forth.


Download ppt "CREATED BY : VIRAL M.KORADIYA. Anchor elements are defined by the element. The element accepts several attributes, but either the Name or HREF attribute."

Similar presentations


Ads by Google