<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Blakesabbath&#039;s Blog</title>
	<atom:link href="http://blakesabbath.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blakesabbath.wordpress.com</link>
	<description>BlakeSabbath Blog</description>
	<lastBuildDate>Fri, 22 Jan 2010 16:27:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blakesabbath.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Blakesabbath&#039;s Blog</title>
		<link>http://blakesabbath.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blakesabbath.wordpress.com/osd.xml" title="Blakesabbath&#039;s Blog" />
	<atom:link rel='hub' href='http://blakesabbath.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Networking &#8211; OSI Layers</title>
		<link>http://blakesabbath.wordpress.com/2010/01/22/networking-osi-layers/</link>
		<comments>http://blakesabbath.wordpress.com/2010/01/22/networking-osi-layers/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 02:45:18 +0000</pubDate>
		<dc:creator>blake</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://blakesabbath.wordpress.com/?p=9</guid>
		<description><![CDATA[Goals Learn the basics of the OSI model. Learn the differences between connection-oriented and connectionless services. Learn about the different types of addresses used in an internetwork. Learn about flow control and error-checking basics. Introduction This chapter works with the next six chapters to act as a foundation for the technology discussions that follow. In [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blakesabbath.wordpress.com&amp;blog=11581950&amp;post=9&amp;subd=blakesabbath&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Goals</h2>
<ul>
<li>Learn the basics of the OSI model.</li>
<li>Learn the differences between connection-oriented and connectionless services.</li>
<li>Learn about the different types of addresses used in an internetwork.</li>
<li> Learn about flow control and error-checking basics.</li>
</ul>
<h2><strong>Introduction </strong></h2>
<p>This chapter works with the next six chapters to act as a foundation for the technology discussions that follow. In this chapter, some fundamental concepts and terms used in the evolving language of internetworking are addressed. In the same way that this book provides a foundation for understanding modern networking, this chapter summarizes some common themes presented throughout the remainder of this book. Topics include flow control, error checking, and multiplexing, but this chapter focuses mainly on mapping the Open System Interconnection (OSI) model to networking/internetworking functions, and also summarizing the general nature of addressing schemes within the context of the OSI model. The OSI model represents the building blocks for internetworks. Understanding the conceptual model helps you understand the complex pieces that make up an internetwork. What Is an Internetwork?  An internetwork is a collection of individual networks, connected by intermediate networking devices, that functions as a single large network. Internetworking refers to the industry, products, and procedures that meet the challenge of creating and administering internetworks. Figure 1-1 illustrates some different kinds of network technologies that can be interconnected by routers and other networking devices to create an internetwork.<strong><a name="1020553"><strong> </strong></a></strong></p>
<p><strong><span id="more-9"></span><br />
</strong></p>
<h3><a name="xtocid3">History of Internetworking</a></h3>
<p>The first networks were time-sharing networks that used mainframes and attached terminals. Such environments were implemented by both IBM&#8217;s Systems Network Architecture (SNA) and Digital&#8217;s network architecture.</p>
<p><em>Local-area networks (LANs)</em> evolved around the PC revolution. LANs enabled multiple users in a relatively small geographical area to exchange files and messages, as well as access shared resources such as file servers and printers.</p>
<p><a name="1020563"><em>Wide-area networks (WANs)</em> interconnect LANs with geographically dispersed users to create connectivity. Some of the technologies used for connecting LANs include T1, T3, ATM, ISDN, ADSL, Frame Relay, radio links, and others. New methods of connecting dispersed LANs are appearing everyday.</a></p>
<p><a name="1020563">Today, high-speed LANs and switched internetworks are becoming widely used, largely because they operate at very high speeds and support such high-bandwidth applications as multimedia and videoconferencing.</a></p>
<p><a name="1020563">Internetworking evolved as a solution to three key problems: isolated LANs, duplication<br />
of resources, and a lack of network management. </a><a name="1020567">Isolated LANs made electronic </a><a name="1020568">communication between different offices or departments impossible. </a><a name="1020569">Duplication of resources meant that the same hardware and software had to be supplied to each office or department, as did separate support staff. This lack of network management meant that no centralized method of managing and troubleshooting networks existed.</a></p>
<h3><a name="xtocid4">Internetworking Challenges</a></h3>
<p><a name="1020571">Implementing a functional internetwork is no simple task. Many challenges must be faced, especially in the areas of connectivity, reliability, network management, and flexibility. Each area is key in establishing an efficient and effective internetwork.</a></p>
<p><a name="1020571">The challenge when connecting various systems is to support communication among disparate technologies. Different sites, for example, may use different types of media operating at varying speeds, or may even include different types of systems that need to communicate.</a></p>
<p><a name="1020571">Because companies rely heavily on data communication, internetworks must provide a certain level of reliability. This is an unpredictable world, so many large internetworks include redundancy to allow for communication even when problems occur.</a></p>
<p><a name="1020571">Furthermore, network management must provide centralized support and troubleshooting capabilities in an internetwork. Configuration, security, performance, and other issues must be adequately addressed for the internetwork to function smoothly. Security within an internetwork is essential. Many people think of network security from the perspective of protecting the private network from outside attacks. However, it is just as important to protect the network from internal attacks, especially because most security breaches come from inside. Networks must also be secured so that the internal network cannot be used as a tool to attack other external sites.</a></p>
<p><a name="1020571">Early in the year 2000, many major web sites were the victims of</a><a name="1020576"> distributed denial of service (DDOS) attacks. These attacks were possible because a great number of private </a><a name="1020578">networks currently connected with the Internet were not properly secured. These private networks were used as tools for the attackers.</a></p>
<p><a name="1020578">Because nothing in this world is stagnant, internetworks must be flexible enough to change with new demands.</a></p>
<h2><a name="xtocid5">Open System Interconnection Reference Model</a></h2>
<p><a name="1020581">The <em>Open System Interconnection (OSI) reference model</em> describes how information from a software application in one computer moves through a network medium to a software application in another computer. The OSI reference model is a conceptual model composed of seven layers, each specifying particular network functions. The model was developed by </a><a name="1020583">the International Organization for Standardization (ISO) in 1984, and it is now considered the primary architectural model for intercomputer communications. The OSI model divides the tasks involved with moving information between networked computers into seven smaller, more manageable task groups. A task or group of tasks is then assigned to each of the seven OSI layers. Each layer is reasonably self-contained so that the tasks assigned to each layer can be implemented independently. This enables the solutions offered by one layer to be updated without adversely affecting the other layers. The following list details the seven layers of the Open System Interconnection (OSI) reference model:</a></p>
<ul><a name="1020583"> </a></p>
<li><a name="1020583">Layer 7—Application </a></li>
<p><a name="1020583"> </a></p>
<li><a name="1020583">Layer 6—Presentation </a></li>
<p><a name="1020583"> </a></p>
<li><a name="1020583">Layer 5—Session </a></li>
<p><a name="1020583"> </a></p>
<li><a name="1020583">Layer 4—Transport </a></li>
<p><a name="1020583"> </a></p>
<li><a name="1020583">Layer 3—Network </a></li>
<p><a name="1020583"> </a></p>
<li><a name="1020583">Layer 2—Data link </a></li>
<p><a name="1020583"> </a></p>
<li><a name="1020583">Layer 1—Physical </a></li>
</ul>
<p><a name="1020583"> <span style="color:#ff0000;"> <strong>Note </strong></span></a><span style="color:#ff0000;"><strong><a name="1020591">A handy way to remember the seven        layers is the sentence &#8220;All people seem to need data processing.&#8221; The        beginning letter of each word corresponds to a layer.</a></strong></span></p>
<ul>
<li>All—Application layer</li>
<li>People—Presentation layer</li>
<li>Seem—Session layer</li>
<li>To—Transport layer</li>
<li>Need—Network layer</li>
<li>Data—Data link layer</li>
<li>Processing—Physical layer</li>
</ul>
<p>Figure 1-1 illustrates the seven-layer OSI reference model.<br />
<strong>Figure 1-1: The OSI Reference Model Contains Seven Independent Layers</strong></p>
<p><strong><img class="alignnone" title="osi1" src="http://www.softpanorama.org/Net/Images/ct840102.gif" alt="" width="120" height="157" /></strong></p>
<h3><a name="xtocid6">Characteristics of the OSI Layers</a></h3>
<p><a name="1020606">The seven layers of the OSI reference model can be divided  into two categories: upper layers and lower layers.</a></p>
<p><a name="1020606">The <em>upper layers</em> of the OSI model deal with application issues and  generally are implemented only in software. The highest layer, the </a> <a name="1020609">application layer, is closest to the end user. Both users and  application layer processes interact with software applications that contain a  communications component. The term upper layer is sometimes used to refer to any  layer above another layer in the OSI model.</a></p>
<p><a name="1020609">The <em>lower layer</em>s of the OSI model handle data transport issues. The </a><a name="1020610">physical layer and the </a><a name="1020612">data link  layer are implemented in hardware and software. The lowest layer, the physical  layer, is closest to the physical network medium (the network cabling, for  example) and is responsible for actually placing information on the medium.</a></p>
<p><a name="1020612">Figure 1-2 illustrates the division between the upper and lower OSI layers.</a></p>
<p><a name="1020612"><br />
<strong>Figure 1-2: Two Sets of Layers Make Up the OSI Layers</strong></a></p>
<p><strong><img class="alignnone" title="osi2" src="http://www.softpanorama.org/Net/Images/ct840103.gif" alt="" width="195" height="157" /></strong></p>
<h3><a name="xtocid7">Protocols</a></h3>
<p>The OSI model provides a conceptual framework for communication between  computers, but the model itself is not a method of communication. Actual  communication is made possible by using <a name="1020620">communication  protocols. In the context of data networking, a <em>protocol</em> is a formal  set of rules and conventions that governs how computers exchange information  over a network medium. A protocol implements the functions of one or more of the  OSI layers.</a></p>
<p><a name="1020620">A wide variety of communication protocols exist. Some of these protocols  include LAN protocols, </a><a name="1020622">WAN protocols, network protocols,  and routing protocols. </a><a name="1020623"><em>LAN protocols</em> operate at  the physical and data link layers of the OSI model and define communication over  the various LAN media. <em>WAN protocols</em> operate at the lowest three layers  of the OSI model and define communication over the various wide-area media. </a> <a name="1020624"><em>Routing protocols</em> are network layer protocols that  are responsible for exchanging information between routers so that the routers  can select the proper path for network traffic. Finally, </a><a name="1020625"> <em>network protocols</em> are </a><a name="1020626">the various upper-layer  protocols that exist in a given protocol suite. Many protocols rely on others  for operation. For example, many routing protocols use network protocols to  exchange information between routers. This concept of building upon the layers  already in existence is the foundation of the OSI model. </a></p>
<h3><a name="xtocid8">OSI Model and Communication Between Systems</a></h3>
<p>Information being transferred from a software application in one computer  system to a software application in another must pass through the OSI layers.  For example, if a software application in System A has information to transmit  to a software application in System B, the application program in System A will  pass its information to the application layer (Layer 7) of System A. The  application layer then passes the information to the presentation layer (Layer  6), which relays the data to the session layer (Layer 5), and so on down to the  physical layer (Layer 1). At the physical layer, the information is placed on  the physical network medium and is sent across the medium to System B. The  physical layer of System B removes the information from the physical medium, and  then its physical layer passes the information up to the data link layer (Layer  2), which passes it to the network layer (Layer 3), and so on, until it reaches  the application layer (Layer 7) of System B. Finally, the application layer of  System B passes the information to the recipient application program to complete  the communication process.</p>
<h4><a name="xtocid9">Interaction Between OSI Model Layers</a></h4>
<p><a name="1020630">A given layer in the OSI model generally communicates with  three other OSI layers: the layer directly above it, the layer directly below  it, and its peer layer in other networked computer systems. The data link layer  in System A, for example, communicates with the network layer of System A, the  physical layer of System A, and the data link layer in System B. Figure 1-3  illustrates this example.</a></p>
<p><a name="1020630"><br />
<strong>Figure 1-3: OSI Model Layers Communicate with Other Layers</strong></a></p>
<p><strong><img class="alignnone" title="osi3" src="http://www.softpanorama.org/Net/Images/ct840104.gif" alt="" width="340" height="157" /></strong></p>
<h4><a name="xtocid10">OSI Layer Services</a></h4>
<p><a name="1020637">One OSI layer communicates with another layer to make use  of the services provided by the second layer. The services provided by adjacent  layers help a given OSI layer communicate with its peer layer in other computer  systems. Three basic elements are involved in layer services: the service user,  the service provider, and the service access </a><a name="1020639">point (SAP).</a></p>
<p><a name="1020639">In this context, the <em>service user</em> is the OSI layer that requests  services from an adjacent OSI layer. The <em>service provider</em> is the OSI  layer that provides services to service users. OSI layers can provide services  to multiple service users. The SAP is a conceptual location at which one OSI la</a><a name="1020641">yer  can request the services of another OSI layer.</a></p>
<p><a name="1020642">Figure 1-4 illustrates how these three elements  interact at the network and data link layers.</a></p>
<p><a name="1020642"><br />
<strong>Figure 1-4: Service Users, Providers, and SAPs Interact at the Network and  Data Link Layers</strong></a></p>
<p><strong><img class="alignnone" title="osi4" src="http://www.softpanorama.org/Net/Images/ct840105.gif" alt="" width="347" height="226" /></strong></p>
<h4><a name="xtocid11">OSI Model Layers and Information Exchange</a></h4>
<p><a name="1020649">The seven OSI layers use various forms of control  information to communicate with their peer layers in other computer systems.  This <em>control information</em> consists of specific requests and instructions  that are exchanged between peer OSI layers.</a></p>
<p><a name="1020649">Control information typically takes one of two forms: headers and trailers. <em>Headers</em> are </a><a name="1020652">prepended to data that has been  passed down from upper layers. <em>Trailers</em> are appended to data that has  been passed down from upper layers. An OSI layer is not required to attach a  header or a trailer to data from upper layers.</a></p>
<p><a name="1020652">Headers, trailers, and data are relative concepts, depending on the layer  that analyzes the information unit. At the network layer, for example, an </a> <a name="1020654">information unit consists of a Layer 3 header and data. At the  data link layer, however, all the information passed down by the network layer  (the Layer 3 header and the data) is treated as data.</a></p>
<p><a name="1020654">In other words, the data portion of an information unit at a given OSI layer  potentially<br />
can contain headers, trailers, and data from all the higher layers. This is  known as </a><a name="1020656"><em>encapsulation</em>. Figure 1-5 shows how the  header and data from one layer are encapsulated into the header of the next  lowest layer.</a></p>
<p><a name="1020656"><br />
<strong>Figure 1-5: Headers and Data Can Be Encapsulated During Information Exchange</strong></a></p>
<p><strong><img class="alignnone" title="osi5" src="http://www.softpanorama.org/Net/Images/ct840106.gif" alt="" width="423" height="208" /></strong></p>
<h5><a name="1020656">nformation Exchange Process</a></h5>
<p><a name="1020656">The information exchange process occurs between peer OSI layers. Each layer  in the source system adds control information to data, and each layer in the  destination system analyzes and removes the control information from that data.</a></p>
<p><a name="1020656">If System A has data from a software application to send to System B, the  data is passed to the application layer. The application layer in System A then  communicates any control information required by the application layer in System  B by prepending a header to the data. The resulting information unit (a header  and the data) is passed to the presentation layer, which prepends its own header  containing control information intended for the presentation layer in System B.  The information unit grows in size as each layer prepends its own header (and,  in some cases, a trailer) that contains control information to be used by its  peer layer in System B. At the physical layer, the entire information unit is  placed onto the network medium.</a></p>
<p><a name="1020656">The physical layer in System B receives the information unit and passes it to  the data link laye</a><a name="1020666">r. The data link layer in System B then  reads the control information contained in the header prepended by the data link  layer in System A. The header is then removed, and the </a><a name="1020667"> remainder of the information unit is passed to the network layer. Each layer  performs the same actions: The layer reads the header from its peer layer,  strips it off, and passes the </a><a name="1020668">remaining information unit  to the next highest layer. After the application layer performs these actions,  the data is passed to the recipient software application in System B, in exactly  the form in which it was transmitted by the application in System A.</a></p>
<h3><a name="xtocid12">OSI Model Physical Layer</a></h3>
<p><a name="1020670">The physical layer defines the electrical, mechanical,  procedural, and functional specifications for activating, maintaining, and  deactivating the physical link between communicating network systems. Physical  layer specifications define characteristics such as voltage levels, timing of  voltage changes, physical data rates, maximum transmission distances, and  physical connectors. Physical layer implementations can be categorized as either  LAN or WAN specifications. Figure 1-6 illustrates some common LAN and WAN  physical layer implementations.</a></p>
<p><strong><a name="1020670"><strong>Figure 1-6: Physical Layer Implementations Can Be LAN or WAN Specifications</strong></a></strong></p>
<p><strong><strong><img class="alignnone" title="osi6" src="http://www.softpanorama.org/Net/Images/ct840107.gif" alt="" width="400" height="250" /></strong></strong></p>
<h3><a name="xtocid13">OSI Model Data Link Layer</a></h3>
<p>The data link layer provides reliable transit of data across a physical  network link. Different <a name="1020678">data link layer specifications define  different network and protocol characteristics, including physical addressing,  network topology, error notification, sequencing of frames, and flow control. </a><a name="1020679">Physical addressing (as opposed to network addressing)  defines how </a><a name="1020680">devices are addressed at the data link layer. </a><a name="1020681">Network topology consists of the data link layer  specifications that often define how devices are to be physically connected,  such as in a bus or a ring topology. Error notification</a><a name="1020682"> alerts upper-layer protocols that a transmission error has o</a><a name="1020683">ccurred,  and the sequencing of data frames reorders frames that are transmitted out of  sequence. Finally, </a><a name="1020684">flow control moderates the transmission  of data so that the receiving device is not overwhelmed with more traffic than  it can handle at one time.</a></p>
<p><a name="1020685">The Institute of Electrical and Electronics Engineers  (IEEE) has subdivided the data link layer into two sublayers: Logical Link  Control (LLC) and Media Access Control (MAC). Figure 1-7 illustrates the IEEE  sublayers of the data link layer.</a></p>
<p><a name="1020685"><br />
<strong>Figure 1-7: The Data Link Layer Contains Two Sublayers</strong></a></p>
<p><strong><img class="alignnone" title="osi7" src="http://www.softpanorama.org/Net/Images/ct840108.gif" alt="" width="184" height="108" /></strong></p>
<p><a name="1020691">The <em>Logical Link Control (LLC)</em> sublayer of the  data link layer manages communications between devices over a single link of a  network. LLC is defined in the IEEE 802.2 </a><a name="1020693">specification  and supports both connectionless and connection-oriented services used by  higher-layer protocols. IEEE 802.2 defines a number of fields in data link layer  frames that enable multiple higher-layer protocols to share a single physical  data link. The <em>Media Access Control (MAC)</em> sublayer of the data link  layer manages protocol access to the physical network medium. The IEEE MAC  specification defines MAC addresses, which enable multiple devices to uniquely  identify one another at the data link layer.</a></p>
<h3><a name="xtocid14">OSI Model Network Layer</a></h3>
<p><a name="1020695">The network layer defines the network address, which  differs from the MAC address. Some network layer implementations, such as the  Internet Protocol (IP), define network addresses in a way that route selection  can be determined systematically by comparing the source network address with  the destination network address and applying the subnet mask. Because this layer  defines the logical network layout, routers can use this layer to determine how  to forward packets. Because of this, much of the design and configuration work  for internetworks happens at Layer 3, the network layer.</a></p>
<h3><a name="xtocid15">OSI Model Transport Layer</a></h3>
<p>The transport layer accepts data from the session layer and segments the data  for transport <a name="1020699">across the network. Generally, the transport  layer is responsible for making sure that the data is delivered error-free and  in the proper sequence. Flow control generally occurs at the transport layer.</a></p>
<p><a name="1020700">Flow control manages data transmission between devices  so that the transmitting device does not send more data than the receiving  device can process. </a><a name="1020702">Multiplexing enables data from several  applications to be transmitted onto a single physical link. </a> <a name="1020703">Virtual circuits are established, maintained, and terminated  by the transport layer. </a><a name="1020704">Error checking involves creating  various mechanisms for detecting transmission errors, while error recovery  involves acting, such as requesting that data be retransmitted, to resolve any  errors that occur.</a></p>
<p><a name="1020704">The transport protocols used on the Internet are TCP and UDP.</a></p>
<h3><a name="xtocid16">OSI Model Session Layer</a></h3>
<p><a name="1020707">The session layer establishes, manages, and terminates  communication sessions. Communication sessions consist of service requests and  service responses that occur between applications located in different network  devices. These requests and responses </a><a name="1020709">are coordinated by  protocols implemented at the session layer. Some examples of session-layer  implementations include Zone Information Protocol (ZIP), the AppleTalk protocol  that coordinates the name binding process; and Session Control Protocol (SCP),  the DECnet Phase IV session layer protocol.</a></p>
<h3><a name="xtocid17">OSI Model Presentation Layer</a></h3>
<p>The presentation layer provides a variety of coding and conversion functions  that are applied to application layer data. These functions ensure that  information sent from the application layer of one system would be readable by  the application layer of another system. Some examples of presentation layer  coding and conversion schemes include common data representation formats,  conversion of character representation formats, <a name="1020712">common data  compression schemes, and common data encryption schemes.</a></p>
<p><a name="1020712">Common data representation formats, or the use of standard image, sound, and  video formats, enable the interchange of application data between different  types of computer systems. Conversion schemes are used to exchange information  with systems by using different text and data representations, such as EBCDIC  and ASCII. Standard data </a><a name="1020714">compression schemes enable data  that is compressed at the source device to be properly decompressed at the  destination. Standard data encryption schemes enable data encrypted at the  source device to be properly deciphered at the destination.</a></p>
<p><a name="1020714">Presentation layer implementations are not typically associated with a  particular protocol stack. Some well-known standards for video include QuickTime  and Motion Picture Experts Group (MPEG). QuickTime is an Apple Computer  specification for video and audio, and MPEG is a standard for video compression  and coding.</a></p>
<p><a name="1020714">Among the well-known graphic image formats are Graphics Interchange Format  (GIF), Joint Photographic Experts Grou</a><a name="1020717">p (JPEG), and Tagged  Image File Format (TIFF). GIF is a standard for compressing and coding graphic  images. JPEG is another compression and coding standard for graphic images, and  TIFF is a standard coding format for graphic images.</a></p>
<h3><a name="xtocid18">OSI Model Application Layer</a></h3>
<p>The application layer is the OSI layer closest to the end user, which means  that both the OSI <a name="1020720">application layer and the user interact  directly with the software application.</a></p>
<p><a name="1020720">This layer interacts with software applications that implement a  communicating component. Such application programs fall outside the scope of the  OSI model. Application layer functions typically include identifying  communication partners, determining resource availability, and synchronizing  communication.</a></p>
<p><a name="1020720">When identifying communication partners, the application layer determines the  identity and availability of communication partners for an application with data  to transmit.<br />
When determining resource availability, the application layer must decide  whether sufficient network resources for the requested communication exist. In  synchronizing communication, all communication between applications requires  cooperation that is </a><a name="1020723">managed by the application layer.</a></p>
<p><a name="1020723">Some examples of application layer implementations include Telnet, File  Transfer Protocol (FTP), and Simple Mail Transfer Protocol (SMTP).</a></p>
<h2><a name="xtocid19">Information Formats</a></h2>
<p>The data and control information that is transmitted through internetworks  takes a variety of forms. The terms used to refer to these information formats  are not used consistently<br />
in the internetworking industry but sometimes are used interchangeably. Common  information formats include frames, packets, datagrams, segments, messages,  cells, and data units.</p>
<p>A frame is an information unit whose source and destination are data link  layer entities. A frame is composed of the data link layer header (and possibly  a trailer) and upper-layer data. The header and trailer contain control  information intended for the data link layer entity in the destination system.  Data from upper-layer entities is encapsulated in the data link layer header and  trailer. Figure 1-8 illustrates the basic components of a data link layer frame.<br />
<strong>Figure 1-8: Data from Upper-Layer Entities Makes Up the Data Link Layer Frame</strong></p>
<p><strong><img class="alignnone" title="osi8" src="http://1.1.1.1/bmi/www.softpanorama.org/Net/Images/ct840109.gif" alt="" width="427" height="91" /><img class="alignnone" title="osi8" src="http://1.1.1.1/bmi/www.softpanorama.org/Net/Images/ct840109.gif" alt="" width="427" height="91" /></strong></p>
<p>A <a name="1020732"><em>packet</em> is an information unit whose source and  destination are network layer entities. A packet is composed of the network  layer header (and possibly a trailer) and upper-layer data. The header and  trailer contain control information intended for the network layer entity in the  destination system. Data from upper-layer entities is encapsulated in the  network layer header and trailer. Figure 1-9 illustrates the basic components  of a network layer packet.</a></p>
<p><a name="1020732"><br />
<strong>Figure 1-9: Three Basic Components Make Up a Network Layer Packet</strong></a></p>
<p><strong><img class="alignnone" title="osi9" src="http://1.1.1.3/bmi/www.softpanorama.org/Net/Images/ct840110.gif" alt="" width="427" height="91" /></strong></p>
<p><a name="1020738">he term <em>datagram</em> usually refers to an  information unit whose source and destination are network layer entities that  use connectionless network service.</a></p>
<p><a name="1020738">The term <em>s</em></a><a name="1020740"><em>egment</em> usually refers to an  information unit whose source and destination are transport layer entities.</a></p>
<p><a name="1020740">A <em>message</em> i</a><a name="1020742">s an information unit whose source  and destination entities exist above the network layer (often at the application  layer).</a></p>
<p><a name="1020742">A <em>cell</em> is an information unit of a fixed size whose source and  destination are data link layer entities. Cells are used in switched  environments, such as Asynchronous Transfer Mode </a><a name="1020745">(ATM) and  Switched Mu</a><a name="1020746">ltimegabit Data Service (SMDS) networks. A cell  is composed<br />
of the header and payload. The header contains </a><a name="1020747">control  information intended for the destination data link layer entity and is typically  5 bytes long. The payload contains upper-layer data that is encapsulated in the  cell header and is typically 48 bytes long.</a></p>
<p><a name="1020747">The length of the header and the payload fields always are the same for each  cell.<br />
Figure 1-10 depicts the components of a typical cell.</a></p>
<p><a name="1020747"><br />
<strong>Figure 1-10: Two Components Make Up a Typical Cell</strong></a></p>
<p><strong><img class="alignnone" title="osi10" src="http://1.1.1.4/bmi/www.softpanorama.org/Net/Images/ct840111.gif" alt="" width="312" height="130" /></strong></p>
<p><a name="1020753"><em>Data unit</em> is a generic term that refers to a  variety of information units. Some common data units are service data units (SDUs),  protocol data units, and bridge protocol data units (BPDUs). SDUs are  information units from upper-layer protocols that define a service request to a  lower-layer protocol. PDU is OSI terminology for a packet. BPDUs are used by the  spanning-tree algorithm as hello messages.</a></p>
<h2><a name="xtocid20">ISO Hierarchy of Networks</a></h2>
<p>Large networks typically are organized as hierarchies. A hierarchical  organization provides such advantages as ease of management, flexibility, and a  reduction in unnecessary traffic. Thus, the International Organization for  Standardization (ISO) has adopted a number of terminology conventions for  addressing network entities. Key terms defined in this section include end  system (ES), intermediate system (IS), area, and autonomous system (AS).</p>
<p>An<a name="1020757"> <em>ES</em> is a network device that does not perform  routing or other traffic forwarding functions. Typical ESs include such devices  as terminals, personal computers, and printers. An <em>IS</em> is a network  device that performs routing or other traffic-forwarding functions. Typical ISs  include such devices as routers, switches, and bridges. Two types of IS networks  exist: </a><a name="1020759">intradomain IS and interdomain IS. An intradomain  IS communicates within a single autonomous system, while an interdomain IS  communicates within and between autonomous systems. An </a><a name="1020760"> <em>area</em> is a logical group of network segments and their attached devices.  Areas are subdivisions of autonomous systems (AS&#8217;s). An AS is a collection of  networks under a common administration that share a common routing strategy.  Autonomous systems are subdivided into areas, and an AS is sometimes called a  domain. Figure 1-11 illustrates a hierarchical network and its components.</a></p>
<p><a name="1020760"><br />
<strong>Figure 1-11: A Hierarchical Network Contains Numerous Components</strong></a></p>
<p><strong><img class="alignnone" title="osi11" src="http://1.1.1.5/bmi/www.softpanorama.org/Net/Images/ct840112.gif" alt="" width="341" height="252" /></strong></p>
<h2><a name="xtocid21">Connection-Oriented and Connectionless Network  Services</a></h2>
<p>In general, transport protocols can be characterized as being either  connection-oriented or connectionless. Connection-oriented services must first  establish a connection with the desired service before passing any data. A  connectionless service can send the data without <a name="1020767">any need to  establish a connection first. In general, connection-oriented services provide  some level of delivery guarantee, whereas connectionless services do not. </a></p>
<p><a name="1020767">Connection-oriented service involves three phases: connection establishment,  data transfer, and connection termination.</a></p>
<p><a name="1020767">During connection establishment, the end nodes may reserve resources for the  connection. The end nodes also may negotiate and establish certain criteria for  the transfer, such as a window size used in TCP connections. This resource  reservation is one of the things exploited in some denial of service</a><a name="1020770"> (DOS) attacks. An attacking system will send many requests for establishing a  connection but then will never complete the connection. The attacked computer is  then left with resources allocated for many never-completed connections. Then,  when an end node tries to complete an actual connection, there are not enough  resources for the valid connection.</a></p>
<p><a name="1020770">The data transfer phase occurs when the actual data is transmitted over the  connection. During data transfer, most connection-oriented services will monitor  for lost packets and handle resending them. The protocol is generally also  responsible for putting the packets in the right sequence before passing the  data up the protocol stack.</a></p>
<p><a name="1020770">When the transfer of data is complete, the end nodes terminate the connection  and release resources reserved for the connection.</a></p>
<p><a name="1020770">Connection-oriented network services have more overhead than connectionless  ones. Connection-oriented services must negotiate a connection, transfer data,  and tear down the connection, whereas a connectionless transfer can simply send  the data without the added overhead of creating and tearing down a connection.  Each has its place in internetworks.</a></p>
<h2><a name="xtocid22">Internetwork Addressing</a></h2>
<p><a name="1020775"><em>Internetwork addresses</em> identify devices separately  or as members of a group. Addressing schemes vary depending on the protocol  family and the OSI layer. Three types of internetwork addresses are commonly  used: data link layer addresses, Media Access Control (MAC) addresses, and  network layer addresses.</a></p>
<h3><a name="xtocid23">Data Link Layer Addresses</a></h3>
<p>A <em>data link layer address</em> uniquely identifies each physical network  connection of a network <a name="1020779">device. Data-link addresses sometimes  are referred to as <em>physical</em> or <em>hardware addresses</em>. Data-link  addresses usually exist within a flat address space and have a pre-established  and typically fixed relationship to a specific device.</a></p>
<p><a name="1020779">End systems generally have only one physical network connection and thus have  only one data-link address. Routers and other internetworking devices typically  have multiple physical network connections and therefore have multiple data-link  addresses. Figure 1-12 illustrates how each interface on a device is uniquely  identified by a data-link address.</a></p>
<p><a name="1020779"><br />
<strong>Figure 1-12: Each Interface on a Device Is Uniquely Identified by a Data-Link  Address.</strong></a></p>
<p><strong><img class="alignnone" title="osi12" src="http://1.1.1.1/bmi/www.softpanorama.org/Net/Images/ct840113.gif" alt="" width="430" height="246" /></strong></p>
<h3><a name="xtocid24">MAC Addresses</a></h3>
<p><em>Media Access Control (MAC) </em>addresses consist of a subset of data  link layer addresses. <a name="1020788">MAC addresses identify network entities  in LANs that implement the IEEE MAC addresses of the data link layer. As with  most data-link addresses, MAC addresses are unique for each LAN interface.  Figure 1-14 illustrates the relationship between MAC addresses, data-link  addresses, and the IEEE sublayers of the data link layer.</a></p>
<p><a name="1020788"><br />
<strong>Figure 1-14: MAC Addresses, Data-Link Addresses, and the IEEE Sublayers of  the Data Link Layer Are All Related<br />
<img src="http://1.1.1.2/bmi/www.softpanorama.org/Net/Images/ct840114.gif" alt="" width="281" height="115" /></strong> </a></p>
<p><a name="1020788">MAC addresses are 48 bits in length and are expressed as 12 hexadecimal  digits. The first 6 hexadecimal digits, which are administered by the IEEE,  identify the manufacturer or vendor and thus comprise the </a><a name="1020794"> Organizationally Unique Identifier (OUI). The last 6 hexadecimal digits comprise  the </a><a name="1020795">interface serial number, or another value administered  by the specific vendor. MAC addresses sometimes are called</a><a name="1020796"> <em>burned-in addresses (BIAs) </em>because they are burned into read-only  memory (ROM) and are copied into random-access memory (RAM) when the interface  card initializes. Figure 1-15 illustrates the MAC address format. </a></p>
<p><a name="1020796"><br />
<strong>Figure 1-15: The MAC Address Contains a Unique Format of Hexadecimal Digits<br />
<img src="http://1.1.1.3/bmi/www.softpanorama.org/Net/Images/ct840115.gif" alt="" width="232" height="127" /></strong></a></p>
<h3><a name="xtocid25">Mapping Addresses</a></h3>
<p><a name="1020802">Because internetworks generally use network addresses to  route traffic around the network, there is a need to map network addresses to  MAC addresses. When the network layer has determined the destination station&#8217;s  network address, it must forward the information over a physical network using a  MAC address. Different protocol suites use different methods </a> <a name="1020804">to perform this mapping, but the most popular is </a> <a name="1020805">Address Resolution Protocol (ARP).</a></p>
<p><a name="1020805">Different protocol suites use different methods for determining the MAC  address of a device. The following three methods are used most often. Address  Resolution Protocol (ARP) maps network addresses to MAC addresses. The </a> <a name="1020807">Hello protocol enables network devices to learn the MAC  addresses of other network devices. MAC addresses either are embedded in the  network layer address or are generated by an algorithm.</a></p>
<p><a name="1020807">Address Resolution Protocol (ARP) is the method used in the TCP/IP suite.  When a network device needs to send data to another device on the same network,  it knows the source and destination network addresses for the data transfer. It  must somehow map the destination address to a MAC address before forwarding the  data. First, the sending station will check its ARP table to see if it has  already discovered this destination station&#8217;s MAC address. If it has not, it  will send a broadcast on the network with the destination station&#8217;s IP address  contained in the broadcast. Every station on the network receives the broadcast  and compares the embedded IP address to its own. Only the station with the  matching IP address replies to the sending station with a packet containing the  MAC address for the station. The first station then adds this information to its  ARP table for future reference and proceeds to transfer the data.</a></p>
<p><a name="1020807">When the destination device lies on a remote network, one beyond a router,  the process is the same except that the sending station sends the ARP request  for the MAC address of its default gateway. It then forwards the information to  that device. The default gateway will then forward the information over whatever  networks necessary to deliver the packet to the network on which the destination  device resides. The router on the destination device&#8217;s network then uses ARP to  obtain the MAC of the actual destination device and delivers the packet.</a></p>
<p><a name="1020807">The Hello protocol is a </a><a name="1020810">network layer protocol that  enables network devices to identify one another and indicate that they are still  functional. When a new end system powers up, for example, it broadcasts hello  messages onto the network. Devices on the network then return hello replies, and  hello messages are also sent at specific intervals to indicate that they are  still functional. Network devices can learn the MAC addresses of other devices  by examining Hello protocol packets.</a></p>
<p><a name="1020810">Three protocols use predictable MAC addresses. In these protocol suites, MAC  addresses are predictable because the network layer either embeds the MAC  address in the network layer address or uses an algorithm to determine the MAC  address. The three protocols are Xerox Network Systems (XNS), Novell  Internetwork Packet Exchange (IPX), and DECnet Phase IV.</a></p>
<h3><a name="xtocid26">Network Layer Addresses</a></h3>
<p>A <em>network layer address</em> identifies an entity at the network layer of  the OSI layers. Network <a name="1020815">addresses usually exist within a  hierarchical address space and sometimes are called <em>virtual</em> </a> <a name="1020816">or <em>logical addresses</em>.</a></p>
<p><a name="1020816">The relationship between a network address and a device is logical and  unfixed; it typically is based either on physical network characteristics (the  device is on a particular network segment) or on groupings that have no physical  basis (the device is part of an AppleTalk zone). End systems require one network  layer address for each network layer protocol that they support. (This assumes  that the device has only one physical network connection.) Routers and other  internetworking devices require one network layer address per physical network  connection for each network layer protocol supported. For example, a router with  three interfaces each running AppleTalk, TCP/IP, and OSI must have three network  layer addresses for each interface. The router therefore has nine network layer  addresses. Figure 1-16 illustrates how each network interface must be assigned a  network address for each protocol supported.</a></p>
<p><a name="1020816"><br />
<strong>Figure 1-16: Each Network Interface Must Be Assigned a Network Address for  Each Protocol Supported<br />
<img src="http://1.1.1.4/bmi/www.softpanorama.org/Net/Images/ct840116.gif" alt="" width="415" height="390" /></strong> </a></p>
<h3><a name="xtocid27">Hierarchical Versus Flat Address Space</a></h3>
<p>Internetwork address space typically takes one of two forms: hierarchical  address space or <a name="1020824">flat address space. A <em>hierarchical  address space</em> is organized into numerous subgroups, each successively  narrowing an address until it points to a single device (in a manner similar to  street addresses). A <em>flat address space</em> is organized into a single  group (in a manner similar to U.S. Social Security numbers).</a></p>
<p><a name="1020824">Hierarchical addressing offers certain advantages over flat-addressing  schemes. Address sorting and recall is simplified using comparison operations.  For example, &#8220;Ireland&#8221; in a street address eliminates any other country as a  possible location. Figure 1-17 illustrates the difference between hierarchical  and flat address spaces.</a></p>
<p><a name="1020824"><br />
<strong>Figure 1-17: Hierarchical and Flat Address Spaces Differ in Comparison  Operations<br />
<img src="http://1.1.1.5/bmi/www.softpanorama.org/Net/Images/ct840117.gif" alt="" width="427" height="301" /></strong> </a></p>
<h3><a name="xtocid28">Address Assignments</a></h3>
<p><a name="1020832">Addresses are assigned to devices as one of two types:  static and dynamic. <em>Static addresses</em> are assigned by a network  administrator according to a preconceived internetwork addressing plan. A static  address does not change until the network administrator manually changes it. </a> <a name="1020834"><em>Dynamic addresses</em> are obtained by devices when they  attach to a network, by means of some protocol-specific process. A device using  a dynamic address often has a different address each time that it connects to  the network. Some networks use a server to </a><a name="1020835">assign  addresses. Server-assigned addresses are recycled for reuse as devices  disconnect.<br />
A device is therefore likely to have a different address each time that it  connects to the network.</a></p>
<h3><a name="xtocid29">Addresses Versus Names</a></h3>
<p><a name="1020837">Internetwork devices usually have both a name and an  address associated with them. Internetwork names typically are  location-independent and remain associated with a device wherever that device  moves (for example, from one building to another). Internetwork addresses  usually are location-dependent and change when a device is moved (although MAC  addresses are an exception to this rule). As with network addresses being mapped  to MAC addresses, names are usually mapped to network addresses through some  protocol. The Internet uses </a><a name="1020839">Domain Name System (DNS) to  map the name of a device to its IP address. For example, it&#8217;s easier for you to  remember <a href="http://www.cisco.com" rel="nofollow">http://www.cisco.com</a> instead of some IP address. Therefore, you type  <a href="http://www.cisco.com" rel="nofollow">http://www.cisco.com</a> into your browser when you want to access Cisco&#8217;s web site. Your  computer performs a DNS lookup of the IP address for Cisco&#8217;s web server and then  communicates with it using the network address.</a></p>
<h2><a name="xtocid30">Flow Control Basics</a></h2>
<p>Flow control is a function that prevents network congestion by ensuring that  transmitting <a name="1020842">devices do not overwhelm receiving devices with  data. A high-speed computer, for example, may generate traffic faster than the  network can transfer it, or faster than the destination device can receive and  process it. The three commonly used methods for handling network congestion are  buffering, transmitting source-quench messages, and windowing. </a></p>
<p><a name="1020843">Buffering is used by network devices to temporarily  store bursts of excess data in memory until they can be processed. Occasional  data bursts are easily handled by buffering. Excess data bursts can exhaust  memory, however, forcing the device to discard any additional datagrams that  arrive. </a></p>
<p><a name="1020843">Source-quench </a><a name="1020845">messages are used by receiving devices to  help prevent their buffers from overflowing. The receiving device sends  source-quench messages to request that the source reduce its current rate of  data transmission. First, the receiving device begins discarding received data  due to overflowing buffers. Second, the receiving device begins sending  source-quench messages to the transmitting device at the rate of one message for  each packet dropped. The source device receives the source-quench messages and  lowers the data rate until it stops receiving the messages. Finally, the source  device then gradually increases the data rate as long as no further  source-quench requests are received.</a></p>
<p><a name="1020845">Windowing is a flow-control scheme in which the source device requires an  acknowledgment from the destination after a certain number of packets have been </a><a name="1020848">transmitted. With a window size of 3, the source requires  an acknowledgment after sending three packets, as follows. First, the source  device sends three packets to the destination device. Then, after receiving the  three packets, the destination device sends an acknowledgment to the source. The  source receives the acknowledgment and sends three more packets. If the  destination does not receive one or more of the packets for some reason, such as  overflowing buffers, it does not receive enough packets to send an  acknowledgment. The source then retransmits the packets at a reduced  transmission rate.</a></p>
<h2><a name="xtocid31">Error-Checking Basics</a></h2>
<p><a name="1020850">Error-checking schemes determine whether transmitted data  has become corrupt or otherwise damaged while traveling from the source to the  destination. Error checking is implemented at several of the OSI layers.</a></p>
<p><a name="1020850">One common error-checking scheme is the cyclic redundancy check (CRC), which  detects and discards corrupted data. Error-correction functions (such as data  retransmission) are left to higher-layer protocols. A CRC value is generated by  a calculation that is performed at the source device. The destination device  compares this value to its own calculation to determine whether errors occurred  during transmission. First, the source device performs a predetermined set of  calculations over the contents of the packet to be sent. Then, the source places  the calculated value in the packet and sends the packet to the destination. The  destination performs the same predetermined set of calculations over the  contents of the packet and then compares its computed value with that contained  in the packet. If the values are equal, the packet is considered valid. If the  values are unequal, the packet contains errors and is discarded.</a></p>
<h2><a name="xtocid32">Multiplexing Basics</a></h2>
<p><em>Multiplexing</em> is a process in which multiple data channels are  combined into a single data <a name="1020855">or physical channel at the source.  Multiplexing can be implemented at any of the OSI layers. Conversely, <em> demultiplexing</em> is the process of separating multiplexed data channels at  the destination. One example of multiplexing is when data from multiple  applications is multiplexed into a single lower-layer data packet. Figure 1-18  illustrates this example.</a></p>
<p><a name="1020855"><br />
<strong>Figure 1-18: Multiple Applications Can Be Multiplexed into a Single  Lower-Layer Data Packet<br />
<img src="http://1.1.1.1/bmi/www.softpanorama.org/Net/Images/ct840118.gif" alt="" width="363" height="157" /></strong> </a></p>
<p><a name="1020855">Another example of multiplexing is when data from multiple devices is  combined into a single physical channel (using a device called a multiplexer).  Figure 1-19 illustrates this example.</a></p>
<p><a name="1020855"><br />
<strong>Figure 1-19: Multiple Devices Can Be Multiplexed into a Single Physical  Channel<br />
<img src="http://1.1.1.2/bmi/www.softpanorama.org/Net/Images/ct840119.gif" alt="" width="426" height="102" /></strong> </a></p>
<p><a name="1020855">A <em>multiplexer</em> is a physical layer device that combines multiple data  streams into one or more output channels at the source. Multiplexers demultiplex  the channels into multiple </a><a name="1020867">data streams at the remote end  and thus maximize the use of the bandwidth of the physical medium by enabling it  to be shared by multiple traffic sources.</a></p>
<p><a name="1020867">Some methods used for multiplexing data are </a><a name="1020868"> time-division multiplexing (TDM), </a><a name="1020870">asynchronous  time-division multiplexing (ATDM), </a><a name="1020871">frequency-division  multiplexing (FDM), and statistical multiplexing.</a></p>
<p><a name="1020871">In TDM, information from each data channel is allocated bandwidth based on  preassigned time slots, regardless of whether there is data to transmit. In ATDM,  information from data channels is allocated bandwidth as needed by using  dynamically assigned time slots. In FDM, information from each data channel is  allocated bandwidth based on the signal frequency of the traffic. In </a> <a name="1020873">statistical multiplexing, bandwidth is dynamically allocated  to any data channels that have information to transmit.</a></p>
<h2><a name="xtocid33">Standards Organizations</a></h2>
<p>A wide variety of organizations contribute to internetworking standards by  providing <a name="1020876">forums for discussion, turning informal discussion  into formal specifications, and proliferating specifications after they are  standardized. </a></p>
<p><a name="1020876">Most standards organizations create formal standards by using specific  processes: organizing ideas, discussing the approach, developing draft  standards, voting on all or certain aspects of the standards, and then formally  releasing the completed standard to the public.</a></p>
<p><a name="1020876">Some of the best-known standards organizations that contribute to  internetworking standards include these:</a></p>
<ul><a name="1020876"> </a></p>
<li><a name="1020879"><strong>International Organization for    Standardization (ISO)</strong>—ISO is an international </a><a name="1020881"> standards organization responsible for a wide range of standards, including    many that </a><a name="1020882">are relevant to networking. Its best-known    contribution is the development of the OSI reference model and the OSI    protocol suite. </a></li>
<p><a name="1020882"> </a></p>
<li><a name="1020883"><strong>American National Standards Institute (ANSI)</strong>—ANSI,    which is also a member of<br />
the ISO, is the coordinating body for voluntary standards groups within the    United </a><a name="1020885">States. ANSI developed the Fiber Distributed Data    Interface (FDDI) and other communications standards. </a></li>
<p><a name="1020885"> </a></p>
<li><a name="1020886"><strong>Electronic Industries Association (EIA)</strong>—EIA    specifies electrical transmission standards, including those used in    networking. The EIA developed the widely used EIA/TIA-232 standard (formerly    known as RS-232). </a></li>
<p><a name="1020886"> </a></p>
<li><a name="1020888"><strong>Institute of Electrical and Electronic    Engineers (IEEE)</strong>—IEEE is a professional organization that defines    networking and other standards. The IEEE developed the widely used LAN    standards IEEE 802.3 and IEEE 802.5. </a></li>
<p><a name="1020888"> </a></p>
<li><a name="1020890"><strong>International Telecommunication Union    Telecommunication Standardization Sector (ITU-T)</strong>—Formerly called the    Committee for International Telegraph and Telephone (CCITT), ITU-T is now an    international organization that develops communication standards. The ITU-T    developed X.25 and other communications standards. </a></li>
<p><a name="1020890"> </a></p>
<li><a name="1020892"><strong>Internet Activities Board (IAB)</strong>—IAB    is a group of internetwork researchers who discuss issues pertinent to the    Internet and set Internet policies through decisions and task forces. The IAB    designates some Request For Comments (RFC) documents as Internet standards,    including Transmission Control Protoc</a><a name="1020894">ol/Internet    Protocol (TCP/IP) and the Simple Network Management Protocol (SNMP). </a></li>
</ul>
<h2><a name="xtocid34">Summary</a></h2>
<p>This chapter introduced the building blocks on which internetworks are built.  Under-standing where complex pieces of internetworks fit into the OSI model will  help you understand the concepts better. Internetworks are complex systems that,  when viewed as a whole, are too much to understand. Only by breaking the network  down into the conceptual pieces can it be easily understood. As you read and  experience internetworks, try to think of them in terms of OSI layers and  conceptual pieces.</p>
<p>Understanding the interaction between various layers and protocols makes  designing, configuring, and diagnosing internetworks possible. Without  understanding of the building blocks, you cannot understand the interaction  between them.</p>
<h2><a name="xtocid35">Review Questions</a></h2>
<p><strong>Q—</strong><em>What are the layers of the OSI model?</em></p>
<p><strong>A—</strong>Application, presentation, session, transport, network,  data link, physical. Remember the sentence &#8220;All people seem to need data  processing.&#8221;</p>
<p><strong>Q—</strong><em>Which layer determines path selection in an  internetwork?</em></p>
<p><strong>A—</strong>Layer 3, the network layer.</p>
<p><strong>Q—</strong><em>What types of things are defined at the physical  layer?</em></p>
<p><strong>A—</strong>Voltage levels, time of voltage changes, physical data  rates, maximum transmission distances, physical connectors, and type of media.</p>
<p><strong>Q—</strong><em>What is one method of mapping network addresses to MAC  addresses?</em></p>
<p><strong>A—</strong>ARP, Hello, predictable.</p>
<p><strong>Q—</strong><em>Which includes more overhead, connection-oriented or  connectionless services?</em></p>
<p><strong>A—</strong>Connection-oriented.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blakesabbath.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blakesabbath.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blakesabbath.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blakesabbath.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/blakesabbath.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/blakesabbath.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/blakesabbath.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/blakesabbath.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blakesabbath.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blakesabbath.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blakesabbath.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blakesabbath.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blakesabbath.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blakesabbath.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blakesabbath.wordpress.com&amp;blog=11581950&amp;post=9&amp;subd=blakesabbath&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blakesabbath.wordpress.com/2010/01/22/networking-osi-layers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58b5e20e84e1012c06a7b7af10d5bb34?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">blake</media:title>
		</media:content>

		<media:content url="http://www.softpanorama.org/Net/Images/ct840102.gif" medium="image">
			<media:title type="html">osi1</media:title>
		</media:content>

		<media:content url="http://www.softpanorama.org/Net/Images/ct840103.gif" medium="image">
			<media:title type="html">osi2</media:title>
		</media:content>

		<media:content url="http://www.softpanorama.org/Net/Images/ct840104.gif" medium="image">
			<media:title type="html">osi3</media:title>
		</media:content>

		<media:content url="http://www.softpanorama.org/Net/Images/ct840105.gif" medium="image">
			<media:title type="html">osi4</media:title>
		</media:content>

		<media:content url="http://www.softpanorama.org/Net/Images/ct840106.gif" medium="image">
			<media:title type="html">osi5</media:title>
		</media:content>

		<media:content url="http://www.softpanorama.org/Net/Images/ct840107.gif" medium="image">
			<media:title type="html">osi6</media:title>
		</media:content>

		<media:content url="http://www.softpanorama.org/Net/Images/ct840108.gif" medium="image">
			<media:title type="html">osi7</media:title>
		</media:content>

		<media:content url="http://1.1.1.1/bmi/www.softpanorama.org/Net/Images/ct840109.gif" medium="image">
			<media:title type="html">osi8</media:title>
		</media:content>

		<media:content url="http://1.1.1.1/bmi/www.softpanorama.org/Net/Images/ct840109.gif" medium="image">
			<media:title type="html">osi8</media:title>
		</media:content>

		<media:content url="http://1.1.1.3/bmi/www.softpanorama.org/Net/Images/ct840110.gif" medium="image">
			<media:title type="html">osi9</media:title>
		</media:content>

		<media:content url="http://1.1.1.4/bmi/www.softpanorama.org/Net/Images/ct840111.gif" medium="image">
			<media:title type="html">osi10</media:title>
		</media:content>

		<media:content url="http://1.1.1.5/bmi/www.softpanorama.org/Net/Images/ct840112.gif" medium="image">
			<media:title type="html">osi11</media:title>
		</media:content>

		<media:content url="http://1.1.1.1/bmi/www.softpanorama.org/Net/Images/ct840113.gif" medium="image">
			<media:title type="html">osi12</media:title>
		</media:content>

		<media:content url="http://1.1.1.2/bmi/www.softpanorama.org/Net/Images/ct840114.gif" medium="image" />

		<media:content url="http://1.1.1.3/bmi/www.softpanorama.org/Net/Images/ct840115.gif" medium="image" />

		<media:content url="http://1.1.1.4/bmi/www.softpanorama.org/Net/Images/ct840116.gif" medium="image" />

		<media:content url="http://1.1.1.5/bmi/www.softpanorama.org/Net/Images/ct840117.gif" medium="image" />

		<media:content url="http://1.1.1.1/bmi/www.softpanorama.org/Net/Images/ct840118.gif" medium="image" />

		<media:content url="http://1.1.1.2/bmi/www.softpanorama.org/Net/Images/ct840119.gif" medium="image" />
	</item>
		<item>
		<title>Joomla 1.0 Tutorial &#8211; Make Custom Template</title>
		<link>http://blakesabbath.wordpress.com/2010/01/22/joomla-1-0-tutorial-make-custom-template/</link>
		<comments>http://blakesabbath.wordpress.com/2010/01/22/joomla-1-0-tutorial-make-custom-template/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 02:14:39 +0000</pubDate>
		<dc:creator>blake</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[Joomla]]></category>

		<guid isPermaLink="false">http://blakesabbath.wordpress.com/?p=3</guid>
		<description><![CDATA[As part of the Official Joomla Documentation program, we have developed a Joomla Template Tutorial. As well as at the official dev.joomla.org) it is also available in our library in various complete formats, Word, PDF and HTML. This tutorial take you through the steps of making a Joomla template using CSS developed by Dan Cedarholm [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blakesabbath.wordpress.com&amp;blog=11581950&amp;post=3&amp;subd=blakesabbath&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As part of the Official <a title="What is Joomla" rel="index.php?view=simplylink&amp;catid=5&amp;id=3&amp;option=com_simplylinks" href="http://www.compassdesigns.net/">Joomla</a> Documentation program, we have developed a Joomla Template Tutorial. As well as at the official dev.joomla.org) it is also available in our library in various complete formats, Word, PDF and HTML. This tutorial take you through the steps of making a Joomla <a title="Joomla templates" rel="index.php?view=simplylink&amp;catid=5&amp;id=9&amp;option=com_simplylinks" href="http://www.compassdesigns.net/joomla-templates">template</a> using CSS developed by Dan Cedarholm of simplebits.com.</p>
<p>In this tutorial, we&#8217;ll go through the steps of creating a joomla template. Joomla is an open source Content Management System (CMS) that is freely (literally) available and supported by a large on-line community. Specifically, we will create a template that uses cascading style sheets (CSS) to produce a layout without use of tables. This is a desirable goal as it means that the template code is easier to validate to World Wide Web Consortium (W3C) standards. It will also tend to load faster, be easier to maintain and perform better in search engines. We will discuss these issues in detail later in the tutorial.</p>
<p><span id="more-3"></span></p>
<p>Included in this tutorial are the following chapters</p>
<ul>
<li>What is a Joomla Template?<br />
Explains what functions are performed by a <a title="Joomla template" rel="index.php?view=simplylink&amp;catid=5&amp;id=6&amp;option=com_simplylinks" href="http://www.compassdesigns.net/joomla-templates">Joomla template</a> and the difference between a template with no content and when content is added into the CMS</li>
<li>Localhost Design Process<br />
How the design process differs to that when designing a static (X)HTML web page.</li>
<li>W3C and Tableless Design The implications of tableless design in Joomla and the relationship between W3C standards, usability and accessibility</li>
<li>The Template Components<br />
What files make up a Joomla template and what functions they perform</li>
<li>Using CSS to create a layout<br />
How to create a source ordered 3 column layout using CSS rather than tables</li>
<li>The Default Joomla CSS<br />
An introduction to basic CSS styles that should be used with Joomla, along with the default list of styles that are used by the Joomla core</li>
<li>Modules<br />
How to place, and style modules, including new techniques for rounded corners.</li>
<li>Menus<br />
A simple strategy to produce lean CSS menus that mimic the effect of those developed with Javascript</li>
<li>Hiding Columns<br />
How to control when columns are shown and how to hide them when no content is present</li>
<li>Conclusion</li>
<li>Appendix A:Tips and Tricks<br />
Variable Page Widths, Rounded Corners, Text Resizers and More</li>
</ul>
<h2><span style="color:#0000ff;"><strong>What is Joomla Template</strong></span></h2>
<p>The Joomla template is a series of files within the Joomla CMS that control the presentation of the content. The Joomla template is not a web site, neither is it to be considered a complete web site design. The template is the basic foundation design for viewing your Joomla! web site. To produce the effect of a &#8220;complete&#8221; web site, the template works hand in hand with the content stored in the Joomla databases. An example of this can be seen below:</p>
<p><img class="alignnone" title="template1" src="http://www.joomlashack.com/images/stories/tuts/template_examples.png" alt="" width="516" height="305" /></p>
<p>This screenshot shows the template in use with sample content. Figure B shows the template as it may look with a raw Joomla installation with little or no content. The template is styled so that when your content is inserted, will inherit the stylesheet defined in the template such as link styles, menus, navigation, text size and colors to name a few. Notice how the images associated with the content (the photos of the people) are <strong>not</strong> part of the template, whereas the image in the header <strong>is</strong> part of the template.</p>
<p>Using a template for a CMS, as Joomla does, has a number of advantages and disadvantages:</p>
<ul>
<li>There is a complete separation of content and presentation, especially when CSS is used for layout (as opposed to having tables in the index.php file). This is one of the main criteria for a site that meets modern web standards.</li>
<li>A new template, and hence a completely new look to a web site can be applied instantly. This can even have different locations/positioning of content as well as colors and graphics.</li>
<li>If different layouts are called for within one web site, it is difficult to achieve. Although different <a title="Joomla Templates" rel="index.php?view=simplylink&amp;catid=5&amp;id=10&amp;option=com_simplylinks" href="http://www.compassdesigns.net/joomla-templates">templates</a> can be applied to different pages, this built in functionality is not reliable. Most designers choose to use various PHP code to show/hide columns depending if there is any content published in that location (discussed in tips and tricks).</li>
</ul>
<h2><span style="color:#0000ff;"><strong>Localhost Design Process</strong></span></h2>
<p>The web page you see at a Joomla powered web site is not static. That means it is generating dynamically from content stored in the database. The page that you see is created through various PHP commands that are in the template. This presents some difficulties in the design phase.</p>
<p>It&#8217;s common now to use a &#8220;what you see is what you get&#8221; (WYSIWYG) HTML editor such as Dreamweaver. This means that the designer does not even need to code the HTML. However, this is not possible in the Joomla template design process, WYSIWYG editors cannot display a dynamic page. This means that the designer must code &#8220;by hand&#8221; and the view the output page from the PHP on a served page. With a fast enough connection this could be a web server, but most designers use a &#8220;local server&#8221; on their own computer. This is a piece of software that will serve the web pages on the designer&#8217;s computer.</p>
<p>There is no &#8220;right way&#8221; to create a web page, it depends on the designer&#8217;s own background. Those more graphical make an &#8220;image&#8221; of a page in a graphics program like Photoshop and then break up the images to use (known as slice and dice). More technologically inclined designers will often just jump straight into the CSS and start coding. However, as mentioned above, the Joomla template designer is limited in that he cannot instantly see the effect of his/her coding in the same editor, the modified design process is:</p>
<ol>
<li>Make edits with HTML editor, save changes</li>
<li>Have localhost server running in background to &#8220;run&#8221; Joomla.</li>
<li>View edits in a web browser</li>
<li>Go to 1.</li>
</ol>
<h3>Localhost Server Options</h3>
<p>Several local host servers are available:</p>
<ul>
<li><strong>JSAS</strong> &#8211; Joomla Stand Alone Server. WAMP server that serves up Joomla on Windows based PCs. A self contained Apache &#8211; MySQL &#8211; PHP server<br />
jsas.joomlasolutions.com</li>
<li><strong>XAMPP</strong> is an easy to install Apache Distribution for Linux, Windows, Mac OS X, and Solaris. The package includes the Apache web server, MySQL, SQLite, PHP, etc<br />
<a href="http://www.apachefriends.org/en/xampp.html" rel="nofollow">http://www.apachefriends.org/en/xampp.html</a></li>
</ul>
<p>JSAS does have a significant amount of advertising on it should that concern you.</p>
<div>
<h4>Easy CSS Styling</h4>
<p>One useful technique to make the design process more efficient is to serve a web page that you are designing and then copy and paste the source into an editor. For example, once your layout CSS is set up, you can use one of these localhost servers to serve a page, then View_Source. You then copy and paste that into your editor. You can now easily style the page using CSS and not have to go through the cycle of steps described above.</p>
</div>
<h3>Some HTML Editor Options for Joomla Designers</h3>
<p>For those not able to pay for a commercial editor such as Dreamweaver, there a some free editors available.</p>
<p>Nvu is a solid choice and has built in validation. It also a Mambo/Joomla extension which will be helpful. Nvu is 100% open source.  This means anyone is welcome to <a href="http://nvu.com/download.html" target="_blank">download Nvu at no charge</a>, including the source code if you need to make special changes. You can get the <a href="http://mamboforge.net/frs/download.php/5999/open4gtplbuilder.xpi" target="_blank">extension from Mamboforge</a>. The complete forge project is <a href="http://mamboforge.net/frs/?id=469&amp;release_id=4553" target="_blank">here</a>.</p>
<p>Another choice is actually more of a validator. The &#8220;CSE HTML Validator&#8221; is an all-in-one HTML, XHTML, CSS, link, spelling, and accessibility checker. You can get the free version <a href="http://download8.htmlvalidator.com/cselite.exe" target="_blank">html  validator here.</a></p>
<p>Note that neither of these are &#8220;WYSIWYG&#8221; html editors.</p>
<h2><span style="color:#0000ff;"><strong>W3C and Tableless Design</strong></span></h2>
<p><a href="http://www.usability.gov/" target="_blank">Usability</a>, <a href="http://www.w3.org/WAI/" target="_blank">accessibility</a> and <a href="http://www.google.com/webmasters/seo.html" target="_blank">search engine optimization</a> are all phrases used to describe high quality web pages in today&#8217;s world wide web. In reality, there is a significant amount of overlap between them and a web page that demonstrates the characteristics of one does so for all three. The easiest way to achieve these three goals is to do so using the framework laid out in the <a href="http://www.w3.org/" target="_blank">W3C web standards</a>.</p>
<p>For example, a site that is (x)html semantically structured (the xhtml explains the document, not how it looks) will be easily read in a screen reader by someone who has poor vision. It will also be easily read by a search engine spider. Google is effectively blind in how it reads your web site</p>
<p><img class="alignnone" title="template2" src="http://www.compassdesigns.net/images/stories/articles/w3cvalidwebsiteoverlap.png" alt="" width="320" height="413" /></p>
<p>A site that is validates to the World Wide Web Consortium&#8217;s (W3C) web standards has a much better foundation for making it accessible, usable and search engine optimized. Think of these as building codes for your house. A web site built with them is stronger and safer. You can check your pages with the <a href="http://validator.w3.org/" target="_blank">W3C&#8217;s HTML validation service</a>. for free. At its simplest, a site that meets W3C validation uses <strong>semantic (x)html and separates content from presentation using CSS</strong>.</p>
<p>To help you understand where web standards came from, some history is helpful. Many web pages are actually designed for older browsers. Why? Browsers have continually evolved since the www started. New ones have appeared and old ones have disappeared (remember Netscape?). Another complicating factor is that different browser makers (like Microsoft) tend to have their browsers interpret html/xhtml in slightly different ways. This has lead to web designers having to design their websites to support older browsers rather than new ones. It&#8217;s often decided that the web page needs to appear properly to these &#8220;legacy&#8221; browsers.</p>
<p>Web standards put into place a common set of &#8220;rules&#8221; for all web browsers to use to show a web page. The main organization pushing these standards is the <a title="WC3 Homepage" href="http://www.w3.org/" target="_blank">World Wide Web Consortium</a> (W3C), whose Director, Tim Berners-Lee has the distinction of actually inventing the world wide web in 1989.</p>
<p>Ask five designers what web standards are and you will get five answers. But most agree that they are based on the following:</p>
<ul>
<li><strong>Valid code, whether html or xhtml (or others) </strong><br />
Earlier we used an example of building codes for construction. The standards outlined for the code that makes a web page have been developed to achieve consistency. It&#8217;s easy to check your code at <a href="http://validator.w3.org/" target="_blank">validator.w3.org</a>. Make sure you use the correct DOCTYPE when you try and validate your code.</li>
<li><strong>Semantically Correct Code</strong><br />
We mentioned before that being semantic means that the (x)html in the web page describes only content, not presentation. In particular this means structured organization of h1/h2 etc tags and only using tables for tabular data, not to layout a web page.</li>
<li><strong>Cascading Style Sheets (CSS)</strong><br />
Closely related to having semantic code, is using cascading style sheets to control the look and layout of your web page. Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents. (Source: <a href="http://www.w3.org/Style/CSS/" target="_blank">http://www.w3.org/Style/CSS/</a>). They exist parallel to the (x)html code and so let you completely separate content (semantic code) form presentation (CSS). The best example of this is <a href="http://www.csszengarden.com/" target="_blank">CSS Zen Garden</a>, a site where the <strong>same semantic xhtml </strong>is shaped in different and unique ways with different CSS. The result is pages that look <strong>very different but have the same core content</strong>.</li>
</ul>
<p>Designing Joomla powered sites currently presents considerable challenges to meet validation standards. In the current series of releases, 1.0.X, the code uses a significant amount of tables to output its pages. This isn&#8217;t really using CSS for presentation, nor does it produce semantically correct code. This problem is compounded by the fact that very few 3rd party developers are using CSS either, most use table to generate their code too. However, tableless is not the same as valid. Its quite possible to have a site that uses tables to validate, it just makes it harder. A useful thread on the Joomla forums go into this in more detail:</p>
<p><a href="http://forum.joomla.org/index.php/topic,24921.0.html">Easy tricks to remove many tables from the standard output of Joomla!</a></p>
<p>Fortunately, the Joomla Core Development team recognize this issue of Joomla. While in 1.1 there will be no changes towards removing tables from the core, a roadmap has be defined that begins to address this in the 1.2 release and on.</p>
<p>Regardless, care can still be taken when creating a template so that it is accessible (e.g. scalable font sizes), usable (e.g. clear navigation) and optimized for search engines (e.g. source ordered).</p>
<h2><span style="color:#0000ff;">The Template Component</span></h2>
<p>In order to understand the contents of a template, we will start by looking at a blank joomla template.</p>
<p>Important Update</p>
<p>The PDF version and template files are in a new location in our Joomla 1.5 powered library.</p>
<ul>
<li><a href="http://www.compassdesigns.net/downloads.html?view=list&amp;category_id=4#flag21">The PDF version of the Joomla 1.0 template tutorial</a></li>
<li><a href="http://www.compassdesigns.net/downloads.html?view=list&amp;category_id=2#flag13">The Blank Joomla 1.0 template for the tutorial </a></li>
</ul>
<p>In this template are the various files and folders that make up a Joomla template. These files must be placed in the /templates directory of a Joomla installation. So, if we had two templates installed, our directory would look something like:</p>
<div style="padding-left:30px;">/templates<br />
/JS_Smoothportal<br />
/JS_Synergy</div>
<p>Note that the directory names for the templates must be the same as the name of the template, in this case JS_Smoothportal and JS_Synergy. Obviously they are case sensitive and shouldn&#8217;t contain spaces. Traditionally the designers initials or name is used as a prefix.</p>
<p>Within the directory of a template, there are a number of key files:</p>
<div style="padding-left:30px;">/JS_Smoothportal<br />
templateDetails.xml<br />
index.php</div>
<p>These two filenames and location must be matched exactly as this is how they are called by the Joomla core script.</p>
<ul>
<li><strong>templateDetails.xml</strong><br />
(note the uppercase &#8220;D&#8221;) An XML format metadata file that tells Joomla! what other files are needed when loading a web page that uses this template. It also details the author, copyright and what files make up the template (including any images used). The last use of this file is for installing a template when using the admin backend.</li>
<li><strong>index.php</strong><br />
This file is the most important. It lays out the site and tells the joomla CMS where to put the different components and modules. It is a combination of PHP and (X)HTML.</li>
</ul>
<p>In almost all templates, additional files are used. It is conventional (although not required by the core) to name and locate them as shown below:</p>
<div style="padding-left:30px;">/JS_Smoothportal<br />
template_thumbnail.png<br />
/css<br />
template_css.css<br />
/images<br />
logo.png</div>
<ul>
<li><strong>template_thumbnail.png</strong><br />
A web Browser screenshot of the template (usually reduced to around 140 pixels wide and 90 pixels high). After the template has been installed, this functions as a &#8220;Preview image&#8221; visible in the Joomla! administration Template Manager.</li>
<li><strong>css/template_css.css</strong><br />
The CSS of the template. The folder location is optional, but you have to specify where it is. Note that the file name is only important in that its referenced in index.php. You could call it what you like. Usually the name shown is used, but we will see later that there are advantages in having other css files too.</li>
<li><strong>images/logo.png</strong><br />
Any images that go with the template. Again for organization reasons, most designers put this in an images folder. Here we have a image file called logo.png as an example.</li>
</ul>
<p>To add the template (again, copious tutorials exist) you go to the admin portion of your site and install the template by uploading the zip file. Note you can actually add the files individually (not in a zip) too. You have to put them in yoursite.com/<strong>templates.</strong></p>
<h3>templateDetails.xml</h3>
<p>The templateDetails.xml must include all the files that are part of the template. It also includes information such as the author and copyright. Some of these are shown in the admin backend in the Template Manager</p>
<p>An example xml file is shown below:</p>
<div style="padding-left:30px;">&lt;mosinstall type=&#8221;template&#8221; version=&#8221;1.0.x&#8221;<br />
&lt;name<br />
&lt;creationDate<br />
&lt;author<br />
&lt;copyright<br />
&lt;authorEmail<br />
&lt;version<br />
&lt;description<br />
&lt;files<br />
&lt;filename<br />
&lt;filename<br />
&lt;filename<br />
&lt;/files<br />
&lt;images<br />
&lt;filename<br />
&lt;filename<br />
&lt;filename<br />
&lt;/images<br />
&lt;css<br />
&lt;filename<br />
&lt;filename<br />
&lt;/css<br />
&lt;/mosinstall</div>
<p>Lets explain what some of these lines mean:</p>
<ul>
<li><strong>mosinstall<br />
</strong>The contents of the XML document  are instructions for the installer. the option <strong>type=&#8221;template&#8221; </strong>tells the installer that we are installing a template</li>
<li><strong>name</strong>:<br />
Defines the name of your template. The name you enter here will also be used to create the directory within the templates directory. Therefore it should not contain any characters that the file system cannot handle, for example spaces. If installing manually, you need to create a directory that is identical to the template name.</li>
<li><strong>creationDate:</strong><br />
The date the template was created. It is a free form field and can be anything like May 2005, 08-June-1978, 01/01/2004 etc.</li>
<li><strong>author:</strong><br />
The name of the author of this template &#8211; most likely your name</li>
<li><strong>copyright</strong>:<br />
Any copyright information goes into this element. A <a href="http://forum.joomla.org/index.php/topic,22653.0.html">Licensing Primer for Developers &amp; Designers</a> can be found on the Joomla forums.</li>
<li><strong>authorEmail</strong>:<br />
Email address where the author of this template can be reached.</li>
<li><strong>authorURL</strong>:<br />
The URL of the author&#8217;s web site</li>
<li><strong>version</strong>:<br />
The version of this template</li>
<li><strong>files:</strong><br />
The &#8220;files&#8221; sections contains all generic files like the PHP source for the template or the thumbnail image for the template preview. Each file listed in this section is enclosed by &lt;filename</li>
<li><strong>images:</strong><br />
All image files that the template uses are listed in the images section. Again each file listed is enclosed by &lt;filename<br />
&lt;filename</li>
<li><strong>css:</strong><br />
The stylesheet is listed in the css section. Again the filename is enclosed by &lt;filename</li>
</ul>
<h3>The index.php</h3>
<p>What actually is in an index.php file? It is a combination of (X)HTML and PHP that determines everything about the layout and presentation of the pages.</p>
<p>First we will look at a critical part of achieving valid templates, the DOCTYPE at the top of the index.php file. This bit of code that code goes at the very top of any web page. At the top of our page we have this in our template:</p>
<div style="padding-left:30px;">&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;</a><br />
&lt;html xmlns=&#8221;<a href="http://www.w3.org/1999/xhtml&#8221;" rel="nofollow">http://www.w3.org/1999/xhtml&#8221;</a><br />
lang=&#8221;&lt;?php echo _LANGUAGE; ?</div>
<p>A web page DOCTYPE is part of the fundamental components of who a web page is shown by a browser, specifically, how that browser interprets CSS. To give you a sense, an observation from alistapart.com says:</p>
<p>[information on W3C's site about doctypes is] &#8220;written by geeks for geeks. And when I say geeks, I donÙt mean ordinary web professionals like you and me. I mean geeks who make the rest of us look like Grandma on the first day SheÙs Got Mail.™&#8221;</p>
<p>Anyway, there are several doctypes you can use. Basically, the doctype tells the browser how to interpret the page. Here the words &#8220;strict&#8221; and &#8220;transitional&#8221; start getting floated around (float:left and float:right usually). Essentially, ever since the WWW started, different browsers have had different levels of support for CSS. This means for example, that Internet Explorer won&#8217;t understand the &#8220;min-width&#8221; command to set a minimum page width. To duplicate the effect you have to use &#8220;hacks&#8221; in the CSS.</p>
<p>Strict means the html (or xhtml) will be interpreted exactly as dictated by standards. A transitional doctype means that the page will be allowed a few agreed upon differences to the standards.</p>
<p>To complicate things, there is something called &#8220;quirks&#8221; mode. If the doctype is wrong, outdated, or not there, then the browser goes into quirks mode. This is an attempt to be backwards compatible, so Internet Explorer for example, will render the page pretending as if it was IE4.</p>
<p>Unfortunately, people sometimes end up in quirks mode accidentally. It usually happens two ways:</p>
<ul>
<li>They use the doctype declaration straight from the WC3 web page, the link ends up as:
<div>DTD/xhtml1-strict.dtd</div>
<p>Except this is a relative link on the WC3 server. You need the full path as  shown above.</li>
<li>Microsoft  set up IE6 so you could have valid pages, but be  in quirks mode. This happens by having an &#8220;xml prolog&#8221; put <strong>before</strong> the doctype.
<div>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;iso-8859-1&#8243;?</div>
</li>
</ul>
<p>The part about IE6 quirks mode is important. In this tutorial we will only be designing for IE6+, so we will make sure that its running in standards mode. This will minimize the hacks we have to do later on. The xml prolog isn&#8217;t essential anyway, we&#8217;ll be taking note of future releases of Joomla and be leaving it off.</p>
<p>Making a page standards compliant, where you see &#8220;valid xhtml&#8221; at the bottom of the page does not mean really difficult coding, or hard to understand tags. It merely means that the code you use matches the doctype you said it would. That&#8217;s it! Nothing else. Designing your site to standards can on one level be reduced to saying what you do, and then doing what you say.</p>
<p>Some useful links:</p>
<ul>
<li><a href="http://www.quirksmode.org/css/quirksmode.html" target="_blank">http://www.quirksmode.org/css/quirksmode.html</a></li>
<li><a href="http://www.alistapart.com/stories/doctype" target="_blank">http://www.alistapart.com/stories/doctype</a></li>
<li><a href="http://www.w3.org/QA/2002/04/Web-Quality" target="_blank">http://www.w3.org/QA/2002/04/Web-Quality</a></li>
<li><a href="http://forum.joomla.org/index.php/topic,7537.0.html" target="_blank">http://forum.joomla.org/index.php/topic,7537.0.html</a></li>
<li><a href="http://forum.joomla.org/index.php/topic,6048.0.html" target="_blank">http://forum.joomla.org/index.php/topic,6048.0.html</a></li>
</ul>
<h3>What else is in  index.php?</h3>
<p>Let&#8217;s look at the structure of the header first, we want to be as minimal as possible, but still have enough for a production site. The header information we will use is:</p>
<div style="padding-left:30px;">&lt;?php defined( &#8216;_VALID_MOS&#8217; ) or die( &#8216;Direct Access to this location is not allowed.&#8217; ); ?<br />
&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;</a><br />
&lt;html xmlns=&#8221;<a href="http://www.w3.org/1999/xhtml&#038;#8221" rel="nofollow">http://www.w3.org/1999/xhtml&#038;#8221</a>; lang=&#8221;&lt;?php echo _LANGUAGE; ?<br />
&lt;head<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; &lt;?php echo _ISO; ?<br />
&lt;?php<br />
if ($my-<br />
&lt;?php mosShowHead(); ?<br />
&lt;script type=&#8221;text/javascript&#8221;<br />
&lt;!&#8211;<a href="http://www.bluerobot.com/web/css/fouc.asp&#8211;" rel="nofollow">http://www.bluerobot.com/web/css/fouc.asp&#8211;</a><br />
&lt;link href=&#8221;/templates/&lt;?php echo $cur_template; ?<br />
&lt;/head</div>
<p>What does all that mean?</p>
<div>&lt;?php defined( &#8216;_VALID_MOS&#8217; ) or die( &#8216;Direct Access to this location is not allowed.&#8217; ); ?</div>
<p>Makes sure that the file isn&#8217;t being accessed directly.</p>
<div style="padding-left:30px;">&lt;?php defined( &#8216;_VALID_MOS&#8217; ) or die( &#8216;Direct Access to this location is not allowed.&#8217; ); ?<br />
&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;</a><br />
&lt;html xmlns=&#8221;<a href="http://www.w3.org/1999/xhtml&#038;#8221" rel="nofollow">http://www.w3.org/1999/xhtml&#038;#8221</a>; lang=&#8221;&lt;?php echo _LANGUAGE; ?<br />
&lt;head</div>
<p>We talked about this above. The &#8220;&lt;?php echo _LANGUAGE; ?</p>
<div style="padding-left:30px;">&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; &lt;?php echo _ISO; ?</div>
<p>What character set we are using, _ISO is a special constant defining the character set encoding to use.</p>
<div style="padding-left:30px;">&lt;?php if ($my-</div>
<p>This is a script variable that is non-zero if a user is logged in to your site. If a user is logged in then the nominated WYSIWYG Editor is pre-loaded. You may, if you wish, always pre-load the Editor, but generally an anonymous visitor will not have the need to add content. This saves a little script overhead for normal browsing of your site.</p>
<div style="padding-left:30px;">&lt;?php mosShowHead(); ?</div>
<p>Header stuff that is set in the global configuration again. It includes the following tags (in a default installation):</p>
<ul>
<li>&lt;title</li>
<li>&lt;meta name=&#8221;description&#8221; content=&#8221;Installing Joomla, doctype and the blank joomla template&#8221; /</li>
<li>&lt;meta name=&#8221;keywords&#8221; content=&#8221;installing joomla, joomla doctype, blank joomla tempate&#8221; /</li>
<li>&lt;meta name=&#8221;Generator&#8221; content=&#8221;Joomla! &#8211; Copyright (C) 2005 Open Source Matters. All rights reserved.&#8221; /</li>
<li>&lt;meta name=&#8221;robots&#8221; content=&#8221;index, follow&#8221; /</li>
<li>&lt;link rel=&#8221;shortcut icon&#8221; href=&#8221;/images/favicon.ico&#8221; /</li>
</ul>
<div style="padding-left:30px;">&lt;script type=&#8221;text/javascript&#8221;</div>
<p>To stop a bug, that being a flash of un-styled content. Details courtesy of Blue Robot. Note this can be any script file, so if we add one, we can remove this line.</p>
<div style="padding-left:30px;">&lt;link href=&#8221;/templates/&lt;?php echo $cur_template; ?</div>
<p>This line links to the CSS file for the template. The PHP code &lt;?php echo $cur_template; ? will return the name of the current template. This makes this line &#8220;portable&#8221;. When you create a new template you can jsut copy it (along with the whole head code) and not worry about editing anything.</p>
<p>As you will see later, in the temmplate_css.css file, we will use @import as a way to stop the site breaking with Netscape 4. Users of very old browsers won&#8217;t be able to get the CSS sheet so will see our neat un styled content. If you wanted to cater to these older browsers, we would have too many CSS hacks, so we do this.</p>
<h3>A blank joomla template body</h3>
<p>This will be  very very easy! Ready?</p>
<div style="padding-left:30px;">&lt;body<br />
&lt;!&#8211; 1 &#8211;<br />
&lt;!&#8211; 2 &#8211;<br />
&lt;!&#8211; 3 &#8211;<br />
&lt;!&#8211; 4 &#8211;<br />
&lt;!&#8211; 5 &#8211;<br />
&lt;!&#8211; 6 &#8211;<br />
&lt;!&#8211; 7 &#8211;<br />
&lt;/body<br />
&lt;/html</div>
<p>We  have in a reasonably logical order:</p>
<ol>
<li>name of the site</li>
<li>the pathway</li>
<li>top module</li>
<li>left modules</li>
<li>main content</li>
<li>right modules</li>
<li>the default footer  module</li>
</ol>
<p>The goal is to try and come as close to semantic markup as possible. From a web point of view, it means a page can be read by anyone, a browser, a spider or a screen reader. Semantic layout is the cornerstone of accessibility.</p>
<p>Now its worth noting that what we have here really is only the potential for semantic layout. If one were to go ahead and put random modules in random locations, then you would have a mess. An important consideration for CMS sites, a template is only as good as the population of the content. It is this that often trips designers up when trying to validate their site.</p>
<h2><span style="color:#0000ff;">Using CSS to Create Layout</span></h2>
<p>We will be using CSS to make a 3 column layout for the Joomla template. We will also be making it a fluid layout. There are two main types of web page layout, fixed and fluid, and they both refer to how the width of the page is controlled.</p>
<p>The width of the page is an issue because of the many browser resolutions that people surf the web at. Although the percentage is dropping, about 20% of surfers are using an 800&#215;600 resolution. The majority, 76%, are using 1024&#215;768 and higher (source:<a href="http://www.upsdell.com/BrowserNews/stat_trends.htm#res" target="_blank">http://www.upsdell.com</a>). Making a fluid layout means that your valuable web page won&#8217;t be a narrow column in the 1024 resolution, and will all be visible on smaller monitors.</p>
<p>A typical design might use tables to layout the page. They are useful in that you just have to set the width of the columns as percentages, but they have several drawbacks:</p>
<ul>
<li>They have lots of <strong>extra code</strong> compared to CSS layouts. This leads to longer load times (which surfers don&#8217;t like) and poorer performance in search engines. The code can roughly double in size, not just with markup but also something called &#8220;spacer gifs&#8221;. Even big companies sometimes fall into the table trap as seen by a recent contorversey about the <a href="http://www.compassdesigns.net/resources/articles/w3cstandardcssdesign/" target="_blank">new disney.co.uk website</a>.</li>
<li>They are <strong>difficult to maintain</strong>. To change something you have to figure out what all the td/tr are doing. With CSS there are just a few lines to inspect.</li>
<li>The content cannot be <strong>source ordered</strong>. Many surfers of the web do not see web pages on a browser. Those viewing with a text browser or screen reader will read the page from the top left corner to the bottom right. This means that they first view everything in the header and left column (for a 3 column layout) before they get the the middle column, the important stuff. A CSS layout on the other hand allows for &#8220;source-ordered&#8221; content, which means the content can be rearranged in the code/source. Perhaps your most important site visitor is Google, and it uses a screen reader for all intents and purposes.</li>
</ul>
<p>Let&#8217;s look at our layout using CSS. You can position elements (stuff) in several ways using CSS. For a quick introduction a good source is <a href="http://www.brainjar.com/css/positioning/" target="_blank">Brainjar&#8217;s CSS Positioning</a>.</p>
<p>If you are new to CSS you might   read at least one &#8220;beginners guide to CSS&#8221;. Here are a few suggestions:</p>
<p><a title="An Overview of Current CSS Layout Techniques" href="http://particletree.com/features/an-overview-of-current-css-layout-techniques/" target="_blank">Kevin Hale&#8217;s &#8211; An Overview of Current CSS Layout Techniques</a><br />
<a title="CSS Beginner's Guide" href="http://www.htmldog.com/guides/cssbeginner/" target="_blank">htmldog&#8217;s CSS Beginner&#8217;s Guide</a><br />
<a title="Stylesheets Tutorial" href="http://hotwired.lycos.com/webmonkey/templates/print_template.htmlt?meta=/webmonkey/98/15/index0a_meta.html" target="_blank">Mulder&#8217;s Stylesheets Tutorial<br />
</a><a href="http://www.yourhtmlsource.com/stylesheets/" target="_blank">yourhtmlsource.com</a></p>
<p>We will be using float to position our content. At its most basic, the template might look like this:</p>
<div style="padding-left:30px;">&lt;?php defined( &#8216;_VALID_MOS&#8217; ) or die( &#8216;Direct Access to this location is not allowed.&#8217; ); ?<br />
&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;</a><br />
&lt;html xmlns=&#8221;<a href="http://www.w3.org/1999/xhtml&#038;#8221" rel="nofollow">http://www.w3.org/1999/xhtml&#038;#8221</a>; lang=&#8221;&lt;?php echo _LANGUAGE; ?<br />
&lt;head<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; &lt;?php echo _ISO; ?<br />
&lt;?php<br />
if ($my-<br />
&lt;?php mosShowHead(); ?<br />
&lt;script type=&#8221;text/javascript&#8221;<br />
&lt;!&#8211;<a href="http://www.bluerobot.com/web/css/fouc.asp&#8211;" rel="nofollow">http://www.bluerobot.com/web/css/fouc.asp&#8211;</a><br />
&lt;link href=&#8221;/templates/&lt;?php echo $cur_template; ?<br />
&lt;style type=&#8221;text/css&#8221;<br />
#wrap {width:80%;}<br />
#header {}<br />
#sidebar {float:left;width:20%;}<br />
#content {float:left;width:60%;}<br />
#sidebar-2 {float:left;width:20%;}<br />
#footer {clear:both;}<br />
&#8211;<br />
&lt;/head</p>
<p>&lt;body</p>
<p>&lt;div id=&#8221;wrap&#8221;</p>
<p>&lt;div id=&#8221;header&#8221;<br />
&lt;?php echo $mosConfig_sitename; ?<br />
&lt;/div</p>
<p>&lt;div id=&#8221;sidebar&#8221;<br />
&lt;?php mosLoadModules(&#8216;left&#8217;);?<br />
&lt;/div</p>
<p>&lt;div id=&#8221;content&#8221;<br />
&lt;?php mosLoadModules(&#8216;top&#8217;);?<br />
&lt;/div</p>
<p>&lt;div id=&#8221;sidebar-2&#8243;<br />
&lt;?php mosLoadModules(&#8216;right&#8217;);?<br />
&lt;/div</p>
<p>&lt;div id=&#8221;footer&#8221;<br />
&lt;?php include_once( $mosConfig_absolute_path .&#8217;/includes/footer.php&#8217;);?<br />
&lt;/div</p>
<p>&lt;/div</p>
<p>&lt;/body<br />
&lt;/html</p>
</div>
<p>The CSS styles are defined here in the head of the file to show what is going on, but normally they would be in the template_css.css file.</p>
<p>Everything is contained in a box/element called #wrap. This had a width of 80% of the viewport at any time.</p>
<div>
<h4>CSS Shorthand</h4>
<p>Its possible to reduce the amount of CSS by using &#8220;shorthand&#8221;. One example of this is padding and margin styles applied to an element.</p>
<div>margin-top:5px; margin-bottom:5px; margin-left:10px; margin-right:10px;</div>
<p>can be replaced by:</p>
<div>margin: 5px 10px;</div>
<p>There are &#8216;shorthand&#8217; styles at the beginning of each style definition. Once you have figured out the styles, fill the shorthand versions in and delete the long versions. The syntax is:</p>
<div>font: font-size |font-style | font-variant | font-weight | line-height | font-family</div>
<p>Here is an example, rather than this&#8230;</p>
<div>font-size:1em; font-family:Arial,Helvetica,sans-serif; font-style:italic; font-weight:bold; line-height:1.3em;</div>
<p>Have this:</p>
<div>font:bold 1em/1.3em Arial,Helvetica,sans-serif italic;</div>
<p>Read more at <a href="http://home.no.net/junjun/html/shorthand.html" target="_blank">An Introduction to CSS shorthand properties</a> about this syntax.</p>
<p>The left, middle and right columns are each given their own element. Each is floated left and given a percent width that add up to 100%. Theclear:both style on the footer tells the browser to &#8220;stop floating&#8221; and makes the footer stretch across all three columns. This very basic layout would look like this:</p>
<p>[image of 3 column header/footer layout here]</p>
<p>To improve the layout, and to add some breathing room to the content, we need to add some column spacing, commonly called &#8220;gutter&#8221;. Unfortunately, there is a problem here. You might know that <a href="http://tantek.com/CSS/Examples/boxmodelhack.html" target="_blank">Internet Explorer does not interpret CSS correctly</a>. One problem is that calculates width differently. We solve this problem by <strong>not using any padding or borders on something that has a width</strong>. To get our gutter we add another &lt;div element inside the columns.</p>
<div>&lt;div id=&#8221;sidebar&#8221;<br />
&lt;div<br />
&lt;?php mosLoadModules(&#8216;left&#8217;);?<br />
&lt;/div&lt;/div</p>
<p>&lt;div id=&#8221;content&#8221;<br />
&lt;div<br />
&lt;?php mosLoadModules(&#8216;top&#8217;);?<br />
&lt;?php mosMainBody(); ?<br />
&lt;/div&lt;/div</p>
<p>&lt;div id=&#8221;sidebar-2&#8243;<br />
&lt;div<br />
&lt;?php mosLoadModules(&#8216;right&#8217;);?<br />
&lt;/div&lt;/div</p>
</div>
<p>To the CSS we add:</p>
<div>.inside {padding:10px;}</div>
<p>This simple layout is a good one to use for learning about how to use CSS with Joomla. It gives two of the advantages of CSS over table based layouts, it is less code and is easier to maintain. However, it is not source ordered. For that we must use a more advanced layout known as a &#8220;nested float&#8221;. With his kind permission, we will be adapting a layout developed by Dan Cederholm and described in more detail in his <a title="Joomla book" rel="index.php?view=simplylink&amp;catid=5&amp;id=12&amp;option=com_simplylinks" href="http://www.compassdesigns.net/joomla-blog/new-joomla-15-training-video-and-2nd-edition-of-book-released">book</a>.</p>
<h3>Source Ordered Three Column CSS Layout</h3>
<p>To help explain how we are doing this, let&#8217;s look at the end result first.</p>
<p>[PICTURE OF NESTED FLOAT HERE]</p>
<p>The page is split into two main floats. The first, #main-body is floated left, the second, #sidebar-2 is floated right. This is the same as we did before, the #main-body float will appear first in the source code. Now, within main-body, we have two more floats; #content is floated right and #sidebar is floated left. As long as we set our widths correctly, the #content float can appear first in the source code.</p>
<div>&lt;div id=&#8221;wrap&#8221;<br />
&lt;div id=&#8221;header&#8221;<br />
&lt;?php echo $mosConfig_sitename; ?<br />
&lt;?php mospathway() ?<br />
&lt;/div</p>
<p>&lt;div id=&#8221;main-body&#8221;</p>
<p>&lt;div id=&#8221;content&#8221;<br />
&lt;div<br />
&lt;?php mosLoadModules(&#8216;top&#8217;);?<br />
&lt;?php mosMainBody(); ?<br />
&lt;/div</p>
<p>&lt;div id=&#8221;sidebar&#8221;<br />
&lt;div<br />
&lt;?php mosLoadModules(&#8216;left&#8217;);?<br />
&lt;/div</p>
<p>&lt;/div</p>
<p>&lt;div id=&#8221;sidebar-2&#8243;<br />
&lt;div<br />
&lt;?php mosLoadModules(&#8216;right&#8217;);?<br />
&lt;/div</p>
<p>&lt;div id=&#8221;footer&#8221;<br />
&lt;/div</p>
<p>&lt;/div</p>
</div>
<p>So now in the source code we have the order of:</p>
<ol>
<li>#content</li>
<li>#sidebar</li>
<li>#sidebar-2</li>
</ol>
<p>To figure out the widths, we now need to do a little math. Let&#8217;s say we want the side columns to be 25% each. #sidebar-2 is easy, it will just have width:25%. However, #sidebar will need a width defined based on it being within a &lt;div that has a width of 75%. Its width needs to be 33%.</p>
<p>So, 33% of 75% = 25%</p>
<p>The width of #content will need to be the remainder. We will set it to 66%. The last 1% we split between #content and #sidebar.</p>
<p>The CSS will be:</p>
<div>#wrap {width:80%;}<br />
#header {} #footer {<br />
clear:both;<br />
}<br />
#main-body { float:left; width:75%; }#sidebar-2 { float:right; width:25%; } #content { float:right; width:66.5%; } #sidebar { float:left; width:33.5%; }<br />
.inside {<br />
padding:10px;<br />
}</div>
<p>Some CSS designers would recommend building in a small gutter by making the side columns fractionally smaller. This helps the layout stop from breaking in Internet Exporer. If you wish do do this, simply change the width of #sidebar-2 to 24%</p>
<p>The code of the template is shown below. Its in a scroll box so you can copy and paste into the index.php. Note we have removed the layout CSS from the head. We&#8217;ll be putting it into a seperate file.</p>
<div>
<p>&lt;?php defined( &#8216;_VALID_MOS&#8217; ) or die( &#8216;Direct Access to this location is not allowed.&#8217; ); ?<br />
&lt;html xmlns=&#8221;<a href="http://www.w3.org/1999/xhtml&#038;#8221" rel="nofollow">http://www.w3.org/1999/xhtml&#038;#8221</a>; lang=&#8221;&lt;?php echo _LANGUAGE; ?<br />
&lt;head<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; &lt;?php echo _ISO; ?<br />
&lt;?php<br />
if ($my-<br />
&lt;?php mosShowHead(); ?<br />
&lt;script type=&#8221;text/javascript&#8221;<br />
&lt;!&#8211;<a href="http://www.bluerobot.com/web/css/fouc.asp&#8211;" rel="nofollow">http://www.bluerobot.com/web/css/fouc.asp&#8211;</a><br />
&lt;link href=&#8221;/templates/&lt;?php echo $cur_template; ?<br />
&lt;/head</p>
<p>&lt;body</p>
<p>&lt;div id=&#8221;wrap&#8221;</p>
<p>&lt;div id=&#8221;header&#8221;<br />
&lt;?php echo $mosConfig_sitename; ?<br />
&lt;?php mospathway() ?<br />
&lt;/div</p>
<p>&lt;div id=&#8221;main-body&#8221;</p>
<p>&lt;div id=&#8221;content&#8221;<br />
&lt;div<br />
&lt;?php mosLoadModules(&#8216;top&#8217;);?<br />
&lt;?php mosMainBody(); ?<br />
&lt;/div</p>
<p>&lt;div id=&#8221;sidebar&#8221;<br />
&lt;div<br />
&lt;?php mosLoadModules(&#8216;left&#8217;);?<br />
&lt;/div</p>
<p>&lt;/div</p>
<p>&lt;div id=&#8221;sidebar-2&#8243;<br />
&lt;div<br />
&lt;?php mosLoadModules(&#8216;right&#8217;);?<br />
&lt;/div</p>
<p>&lt;div id=&#8221;footer&#8221;<br />
&lt;/div</p>
<p>&lt;/div</p>
<p>&lt;/body</p>
</div>
<p>{mostitle=The Default Joomla CSS}</p>
<h3>The Default Joomla CSS</h3>
<p>So far all of our CSS has been only about layout. That will make a pretty plain page, so let&#8217;s add some formatting. We will also move all of the CSS code out of the header of the index.php and into CSS files.</p>
<p>Although it might slow your site down by a tiny amount, it is more flexible to have sub-files for CSS, and then have them all imported by the template_css.css, an example might look  like this:</p>
<div>
<p>@import url(&#8220;layout.css&#8221;); /*layout css file*/<br />
/* @import url(&#8220;color.css&#8221;); color css file*/<br />
@import url(&#8220;customize.css&#8221;); /*Use this file to customize your website*/</p>
</div>
<p>As mentioned earlier, we use @import because Netscape 4 does not understand this command. It also doesn&#8217;t undertsand CSS, so it will just see our unstyled content as a text browser would.</p>
<p>All of the CSS relating to layout would go in the layout.css file. Once set up you can just leave it and know that any changes you make to other stylesheets won&#8217;t do anything drastic. The color.css file might contain anything related to color (its commented out as shown here). You can then quickly and easily make changes or set up &#8220;color packs&#8221;. Lastly, all our typography and Joomla styling would go in our customize.css file.</p>
<p>Our layout.css file is now:</p>
<div>body {<br />
text-align:center; /*center hack*/<br />
}<br />
#wrap {<br />
width:80%; /*center hack*/<br />
margin:0 auto; /*center hack*/<br />
text-align:left;<br />
}<br />
#header {<br />
text-align:left;<br />
}<br />
#footer {<br />
clear:both;<br />
}<br />
#main-body {<br />
float:left;<br />
width:75%;<br />
}<br />
#sidebar-2 {<br />
float:right;<br />
width:25%;<br />
overflow:hidden;<br />
margin-left:-3px;<br />
}<br />
#content {<br />
float:right;<br />
width:66.5%;<br />
overflow:hidden;<br />
}<br />
#sidebar {<br />
float:left;<br />
width:33.5%;<br />
overflow:hidden;<br />
}<br />
.inside {<br />
padding:10px;<br />
}</div>
<p>We have centered the page by using a small hack. This has to be done because of Internet Explorer. With standards compliant browser we could just say margin:0 10%; to center the page, but IE does not recognize that. So we center the &#8220;text&#8221; of the whole page and then align it back left in the columns.</p>
<p>We have also added two more rules. One is overflow:hidden to each column. This will make the page &#8220;break&#8221; more consistantly as we reduce its width. Secondly we have added a negative margin to sidebar-2. This is purely for Internet Explorer to address some of its issues with CSS. We could apply this rule only to IE by adding a hack (the Tan hack):</p>
<div>* html #sidebar-2 {margin-left:-3px;}</div>
<p>However, hacks are generally troublesome. Its better (in this author&#8217;s opinion) to apply the rule to all browsers, after all, its just 3 pixels.</p>
<p>At the beginning of the customize.css file we will set some overall styles and have what is known as a &#8220;global reset&#8221;.</p>
<div>
<ul>
<li>{</li>
</ul>
<p>margin:0;<br />
paddin:0;<br />
}<br />
h1,h2,h3,h4,h5,h6,p,blockquote,form,label,ul,ol,dl,fieldset,address {<br />
margin: 0.5em 0;<br />
}<br />
li,dd {<br />
margin-left:1em;<br />
}<br />
fieldset {<br />
padding:.5em;<br />
}<br />
body {<br />
font-size:76.1%;<br />
font-family:Verdana, Arial, Helvetica, sans-serif;<br />
line-height:1.3em;<br />
}<br />
#header {<br />
background:#0099FF;<br />
}<br />
#footer {<br />
background:#0099FF;<br />
}<br />
#main-body {<br />
background: #CC0000;<br />
}<br />
#sidebar-2 {<br />
background:#009933;<br />
}<br />
#content {<br />
background: #999999;<br />
}<br />
#sidebar {<br />
background: #009933;<br />
}</p>
</div>
<p>Everything is given a zero margin and padding and then all block level elements are given a bottom margin. This helps acheive browser consistancy. You can read more about the global reset at <a href="http://www.clagnut.com/blog/1287/" target="_blank">clagnut</a> and <a href="http://leftjustified.net/journal/2004/10/19/global-ws-reset/" target="_blank">left-justified</a>.</p>
<p>The font size is set to 76.1%. The reason for this is to try and get more consistant font sizes across browsers. All font sizes are then set in em. Having line-height:1.3em helps readbility. This means that the pages will be more accessible as the viewer will be able to resize the fonts to their own preference. This is discussed more at:<br />
<a href="http://www.thenoodleincident.com/tutorials/typography/template.html" target="_blank">An experiment in typography  at The Noodle Incident (Owen Briggs)</a></p>
<p>Lastly we have added some background colors so that we can see where the columns are.</p>
<p>With a fresh default installation with Joomla 1.0.8, the template now looks like this:</p>
<p><img class="alignnone" title="template3" src="http://www.compassdesigns.net/images/stories/articles/OfficialJoomlaTemplateGuide/1stversion.png" alt="" width="500" height="303" /></p>
<p>Notice that the side columns do not reach their footer. This is because they only extend as far as their content, where the space is red on the left and white on the right, they don&#8217;t exist. If we have a template that has a white background for all three columns, this is no problem. We will use this approach and will have boxes round the modules. If equal height columns are desired that are colored, or have boxes, you must use a background image that will tile vertically. This technique is called &#8220;<strong>Faux Columns</strong>&#8221; and is described by <a href="http://www.stopdesign.com/log/2004/09/03/liquid-bleach.html" target="_blank">Douglas Bowman</a> and <a href="http://www.meyerweb.com/eric/thoughts/2004/09/03/sliding-faux-columns/">Eric Meyer</a>.</p>
<p>[TO DO: DESCRIPTION OF FAUX COLUMNS HERE]</p>
<p>Unfortunately, this technique causes a few problems in Internet Explorer. In some situations, the column background will disappear. This is known as the &#8220;Peekaboo bug&#8221; and is described in more detail at <a href="http://www.positioniseverything.net/explorer/peekaboo.html">Position Is Everything</a>. It is fixed by applying the <a href="http://www.onestab.net/a/pie/explorer/peekaboo.html" target="_blank">Holly Hack</a> (assigning a height of 1% in IE). Here it is slightly modified so that only IE6 is targeted using an !Important statement. This means that no actual hack, i.e. invalid CSS is used.</p>
<div>#wrap{ border:1px solid #999; background: url(../images/threecol-r.gif) repeat-y 75% 0;height:100% !Important;height:1%; }<br />
#wrap-inner { background: url(../images/threecol-l.gif) repeat-y 25.125% 0;height:100% !Important;height:1%; }</div>
<p>Note at very small screen widths (&lt;600px) in Internet Explorer, the layout will start breaking. Its possible to fix this by hacking a minimum width, but we will leave that as an exercise for the designer.</p>
<h3>Joomla Specific CSS</h3>
<p>At the time of writing, the current stable of Joomla is the 1.0.X series. This release still uses significant tables to output content in the main body. Along with these tables there are is CSS output available to the designer to style pages. Based on some research by various community members, the current list is shown below. Note it does not include generic web pages styles like H1, H2, p, ul, a, form etc.</p>
<div>#active_menu<br />
#blockrandom<br />
#contact_email_copy<br />
#contact_text<br />
#emailForm<br />
#mod_login_password<br />
#mod_login_remember<br />
#mod_login_username<br />
#poll<br />
#search_ordering<br />
#search_searchword<br />
#searchphraseall<br />
#searchphraseany<br />
#searchphraseexact<br />
#voteid1,#voteid2&#8230;.<br />
.adminform<br />
.article_seperator<br />
.back_button<br />
.blog<br />
.blog_more<br />
.blogsection<br />
.button<br />
.buttonheading<br />
.category<br />
.clr<br />
.componentheading<br />
.contact_email<br />
.content_rating<br />
.content_vote<br />
.contentdescription<br />
.contentheading<br />
.contentpagetitle<br />
.contentpane<br />
.contentpaneopen<br />
.contenttoc<br />
.createdate<br />
.fase4rdf<br />
.footer<br />
.frontpageheader<br />
.inputbox<br />
.latestnews<br />
.mainlevel<br />
.message<br />
.modifydate<br />
.module<br />
.moduletable<br />
.mostread<br />
.newsfeed<br />
.newsfeeddate<br />
.newsfeedheading<br />
.pagenav<br />
.pagenav_next<br />
.pagenav_prev<br />
.pagenavbar<br />
.pagenavcounter<br />
.pathway<br />
.polls<br />
.pollsborder<br />
.pollstableborder<br />
.readon<br />
.search<br />
.searchintro<br />
.sectionentry1<br />
.sectionentry2<br />
.sectionheader<br />
.sitetitle<br />
.small<br />
.smalldark<br />
.sublevel<br />
.syndicate<br />
.syndicate_text<br />
.text_area<br />
.toclink<br />
.weblinks<br />
.wrapper</div>
<p><strong>Important note about this list.</strong></p>
<p>Many designs you might see actually have given CSS styles that are more specific in their definition. Basically, a more specific rule will over ride a less specific rule.</p>
<p>For example:</p>
<div>a {color:blue;} a:link {color:red;}</p>
<p>.contentheading {color:blue;}<br />
div.contentheading {color:red;}</p>
</div>
<p>The color on a link and the color of the .contentheading will be RED, as that rule is more specific (as .contentheading is contained within a &lt;div</p>
<p>In the case of <a title="Joomla templates" rel="index.php?view=simplylink&amp;catid=5&amp;id=2&amp;option=com_simplylinks" href="http://www.compassdesigns.net/joomla-templates">Joomla templates</a>, you will often see more specific rules used. This often occurs when the class is on a table. More examples:</p>
<div>.moduletable table.moduletable</div>
<ul>
<li>.moduletable is the name of the &lt;div</li>
<li> .moduletable will apply the style regardless of what element the class is on.</li>
</ul>
<div>a.contentpagetitle:link .contentpagetitle a:link</div>
<ul>
<li>a.contentpagetitle:link will apply the style to any a tags with a .contentpagetitle class on them that is a link.</li>
<li> .contentpagetitle a:link will apply the style to any elements INSIDE .contentpagetitle that are a link.</li>
</ul>
<p>Specificity is not easy to understand, its often easier to start by using the most general style possible and then getting more specific if the results are not what you expect.</p>
<p>Some links about specificity:<br />
<a href="http://www.htmldog.com/guides/cssadvanced/specificity/" target="_blank">http://www.htmldog.com/guides/cssadvanced/specificity/</a><br />
<a href="http://www.meyerweb.com/eric/css/link-specificity.html" target="_blank">http://www.meyerweb.com/eric/css/link-specificity.html</a><br />
<a href="http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html" target="_blank">http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html</a></p>
<p>At the moment our template is using alot of tables, 20 in fact! As mentioned earlier, this slows the pages down and makes them harder to update. To reduce the number of tables we need to use $style suffixes in the index.php when we call the modules.</p>
<h2><span style="color:#0000ff;">Modules</span></h2>
<p>When a module is called in the index.php, it has several option on how it is displayed. The syntax is:</p>
<div>mosLoadModules(&#8216;$position_name&#8217;[, $style] )</div>
<p>The $style is optional and can be 0, 1, -1, -2 or -3.</p>
<p>0 = (default display) Modules are displayed in a column. The following shows an example of the output:</p>
<div>&lt;table cellpadding=&#8221;0&#8243; cellspacing=&#8221;0&#8243;<br />
&lt;tr<br />
&lt;th valign=&#8221;top&#8221;<br />
&lt;/tr<br />
&lt;tr<br />
&lt;td<br />
&lt;/tr<br />
&lt;/table</div>
<p>1 = Modules are displayed horizontally. Each module is output in the cell of a wrapper table. The following shows an example of the output:</p>
<div>&lt;!&#8211; Module wrapper &#8211;<br />
&lt;table cellspacing=&#8221;1&#8243; cellpadding=&#8221;0&#8243; border=&#8221;0&#8243; width=&#8221;100%&#8221;<br />
&lt;tr<br />
&lt;td align=&#8221;top&#8221;<br />
&lt;tr<br />
&lt;th valign=&#8221;top&#8221;<br />
&lt;/tr<br />
&lt;tr<br />
&lt;td<br />
&lt;/tr<br />
&lt;/table<br />
&lt;/td<br />
&lt;td align=&#8221;top&#8221;<br />
&lt;/td<br />
&lt;/tr<br />
&lt;/table</div>
<p>-1 = Modules are displayed as raw output and without titles. The following shows an example of the output:</p>
<div>Module Output</div>
<p>-2 = Modules are displayed in CSS format enclosed by a &lt;div.                  The following shows an example of the output:</p>
<div>&lt;div<br />
&lt;h3<br />
Module output<br />
&lt;/div</div>
<p>-3 = Modules are  displayed in a format that allows, for example, stretchable rounded  corners. <strong>If this $style is used the name of the &lt;div changes from moduletable to module.</strong> The following shows an example of the output:</p>
<div>&lt;div<br />
&lt;div<br />
&lt;h3<br />
Module output<br />
&lt;/div<br />
&lt;/div</div>
<p>As you can see the CSS options (-1, -2 and -3) are much leaner in code and make it easier to style the web pages. This author does not recommend using suffixes of 0 (default) or 1 unless absolutely needed.</p>
<p>To develop our template, we will put a module $style of &#8220;-2&#8243; on all of our modules:</p>
<div>&lt;body<br />
&lt;div id=&#8221;wrap&#8221;</p>
<p>&lt;div id=&#8221;header&#8221;<br />
&lt;?php echo $mosConfig_sitename; ?<br />
&lt;?php mospathway() ?<br />
&lt;?php mosLoadModules(&#8216;top&#8217;,-2);?<br />
&lt;/div</p>
<p>&lt;div id=&#8221;main-body&#8221;<br />
&lt;div id=&#8221;content&#8221;<br />
&lt;div<br />
&lt;?php mosMainBody(); ?<br />
&lt;/div</p>
<p>&lt;div id=&#8221;sidebar&#8221;<br />
&lt;div<br />
&lt;?php mosLoadModules(&#8216;left&#8217;,-2);?<br />
&lt;/div</p>
<p>&lt;/div</p>
<p>&lt;div id=&#8221;sidebar-2&#8243;<br />
&lt;div<br />
&lt;?php mosLoadModules(&#8216;right&#8217;,-2);?<br />
&lt;/div</p>
<p>&lt;div id=&#8221;footer&#8221;<br />
&lt;?php include_once( $mosConfig_absolute_path .&#8217;/includes/footer.php&#8217; ); ?<br />
&lt;/div</p>
<p>&lt;/div<br />
&lt;/body</p>
</div>
<p>Note that we cannot put these module styles on any of the following as they are not modules.</p>
<ul>
<li>&lt;?php echo $mosConfig_sitename; ?</li>
<li>&lt;?php mospathway() ?</li>
<li>&lt;?php mosMainBody(); ?</li>
<li>&lt;?php include_once( $mosConfig_absolute_path .&#8217;/includes/footer.php&#8217; ); ?</li>
</ul>
<p>Setting the modules to a CSS presentation has reduced the number of tables to 14. Let&#8217;s now add some simple styling to the template to get the result shown below:</p>
<p><img class="alignnone" title="template4" src="http://www.compassdesigns.net/images/stories/articles/OfficialJoomlaTemplateGuide/2ndversion.png" alt="" width="500" height="337" /></p>
<p>First we will place the site title inside an &lt;H1 tag. Its more semantically correct and will also help in SEO.</p>
<div>&lt;h1</div>
<p>We will also add some CSS to style the modules with a border and a background for the header.</p>
<p>Our customize.css now looks like this:</p>
<div>/*Customize.css file */ * {<br />
margin:0;<br />
padding:0;<br />
}<br />
h1,h2,h3,h4,h5,h6,p,blockquote,form,label,ul,ol,dl,fieldset,address{<br />
margin:0.5em 0;<br />
}<br />
ul{<br />
margin-left:2em;<br />
}<br />
fieldset{<br />
padding:.5em;<br />
}<br />
body{<br />
font-size:76.1%;<br />
font-family:Verdana,Arial,Helvetica,sans-serif;<br />
line-height:1.3em;<br />
margin:1em 0;<br />
}<br />
#wrap{<br />
border:1px solid #999;<br />
background: url(../images/threecol-r.gif) repeat-y 75% 0;<br />
height:100% !Important;<br />
height:1%;<br />
}<br />
#wrap-inner {<br />
background: url(../images/threecol-l.gif) repeat-y 25.125% 0;<br />
height:100% !Important;<br />
height:1%;<br />
}<br />
#header{<br />
border-bottom: 1px solid #999;<br />
padding:10px;<br />
}<br />
#footer{<br />
border-top: 1px solid #999;<br />
padding:5px;<br />
}<br />
a{<br />
text-decoration:none;<br />
}<br />
a:hover{<br />
text-decoration:underline;<br />
}<br />
h1,.componentheading{<br />
font-size:1.7em;<br />
line-height:1.7em;<br />
}<br />
h2,.contentheading{<br />
font-size:1.5em;<br />
line-height:1.5em;<br />
}<br />
h3{<br />
font-size:1.3em;<br />
line-height:1.3em;<br />
}<br />
h4{<br />
font-size:1.2em;<br />
line-height:1.2em;<br />
}<br />
h5{<br />
font-size:1.1em;<br />
line-height:1.1em;<br />
}<br />
h6{<br />
font-size:1em;<br />
line-height:1em;<br />
font-weight:bold;<br />
}<br />
#footer,.small,.createdate,.modifydate,.mosimage_caption{<br />
font:0.8em Arial,Helvetica,sans-serif;<br />
color:#999;<br />
}<br />
.moduletable{<br />
margin-bottom:1em;<br />
padding:0 10px;<br />
/*padding for inside text*/ border:1px #CCC solid;<br />
}<br />
.moduletable h3{<br />
background:#666;<br />
color:#fff;<br />
padding:0.25em 0;<br />
text-align:center;<br />
font-size:1.1em;<br />
margin:0 -10px 0.5em -10px;<br />
/*negative padding to pull h3 back out from .moduletable padding*/ }</div>
</div>
<h2><span style="color:#0000ff;">Menus</span></h2>
<p>Setting that control how a menu is outputted are controlled in the <strong>module</strong> that publishes it. When you first make a module you will see a note that tells you that a module has been created with the same name.</p>
<p><img class="alignnone" title="Template6" src="http://www.compassdesigns.net/images/stories/articles/OfficialJoomlaTemplateGuide/newmenu.png" alt="" width="381" height="79" /></p>
<p>In the module for that menu, there are several options for how the menu is presented:</p>
<p><img class="alignnone" title="Template7" src="http://www.compassdesigns.net/images/stories/articles/OfficialJoomlaTemplateGuide/menuoptions.png" alt="" width="371" height="234" /></p>
<ul>
<li><strong>Vertical</strong><br />
The menu appears as a vertical table</li>
<li><strong>Horizontal</strong><br />
The menu appears as a horizontal table</li>
<li><strong>Flat List</strong><br />
The menu appears as a flat &lt;ul CSS list</li>
</ul>
<p>The table format produces code such as:</p>
<div>&lt;div<br />
&lt;h3<br />
&lt;table width=&#8221;100%&#8221; border=&#8221;0&#8243; cellpadding=&#8221;0&#8243; cellspacing=&#8221;0&#8243;<br />
&lt;tr align=&#8221;left&#8221;<br />
&lt;td<br />
&lt;/td<br />
&lt;/tr<br />
&lt;tr align=&#8221;left&#8221;<br />
&lt;td<br />
&lt;/td<br />
&lt;/tr<br />
&lt;tr align=&#8221;left&#8221;<br />
&lt;td<br />
&lt;/td<br />
&lt;/tr<br />
&lt;tr align=&#8221;left&#8221;<br />
&lt;td<br />
&lt;/td<br />
&lt;/tr<br />
&lt;tr align=&#8221;left&#8221;<br />
&lt;td<br />
&lt;/td<br />
&lt;/tr<br />
&lt;tr align=&#8221;left&#8221;<br />
&lt;td<br />
&lt;a href=&#8221;/component/newsfeeds/?amp;Itemid=7&#8243;<br />
&lt;/td<br />
&lt;/tr<br />
&lt;tr align=&#8221;left&#8221;<br />
&lt;td<br />
&lt;/td<br />
&lt;/tr<br />
&lt;tr align=&#8221;left&#8221;<br />
&lt;/td<br />
&lt;/tr<br />
&lt;/table<br />
&lt;/div</div>
<p>The flat list will produce (for the same menu):</p>
<div>&lt;div<br />
&lt;h3<br />
&lt;ul id=&#8221;mainlevel&#8221;<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;/ul<br />
&lt;/div</div>
<p>Again, using CSS lists rather than tables results in reduced code and easier markup. After setting all our menus to flat lists we have only 12 tables (the rest cannot be removed withour hacking). Lists are also better than tables because text-based browsers, screen readers, non-CSS supporting browser, browsers with CSS turned off and search bots will be able to access your content more easily.</p>
<p>One of the other advantages of using CSS for menus is that there is alot of example code on various CSS developer sites. Lets look at one of them and see how it can be used.</p>
<p>A <a href="http://css.maxdesign.com.au/listamatic/index.htm" target="_blank">web page at maxdesign.com</a> has a selection of  over 30 menus all using the same underlying code. Its called the <a href="http://css.maxdesign.com.au/listamatic/index.htm" target="_blank">Listamatic</a>. There is a slight difference in the code that we have to change in order to adapt these menus to Joomla.</p>
<p>These lists use the following code:</p>
<div>&lt;div id=&#8221;navcontainer&#8221;<br />
&lt;ul id=&#8221;navlist&#8221;<br />
&lt;li id=&#8221;active&#8221;<br />
&lt;li<br />
&lt;li<br />
&lt;/ul<br />
&lt;/div</div>
<p>This means that there is an enclosing &lt;div called navcontainer and the &lt;ul has an id of navlist.. To duplicate this effect in Joomla, we need to add a module location, let&#8217;s use user1 before the left modules.</p>
<div>&lt;div id=&#8221;sidebar&#8221;<br />
&lt;div<br />
&lt;div id=&#8221;navcontainer&#8221;<br />
&lt;?php mosLoadModules(&#8216;user1&#8242;,-2);?<br />
&lt;/div<br />
&lt;?php mosLoadModules(&#8216;left&#8217;,-2);?<br />
&lt;/div</div>
<p>Note that we place the mosLoadModules inside the &lt;div that matches those from ListaMatic. This could be any name, but for the purposes of this tutorial, its useful to be able to easily use all those menus!</p>
<p>Next, if there are any references to navlist, for Joomla this is output as mainlevel:</p>
<div>&lt;ul id=&#8221;mainlevel&#8221;</div>
<p>Lastly, we need to add a CSS module suffix to the module in the admin backend so that module can receive unique CSS styles.</p>
<p><img class="alignnone" title="template8" src="http://www.compassdesigns.net/images/stories/articles/OfficialJoomlaTemplateGuide/modulesuffix.png" alt="" width="398" height="125" /></p>
<p>A <strong>Module Class Suffix</strong> can be used on any module. When outputted, the names of the &lt;div for that module will have the suffix appended.</p>
<p>So in this case:</p>
<ul>
<li>If it is using a -2 style it would be .moduletable-leftnav.</li>
<li>If it is using a -3 style it would be .module-leftnav.</li>
</ul>
<p>This use of a module class suffix is very useful. We will see in the Tips and Tricks section that it allows different colored boxes with just a simple change of the module class suffix.</p>
<p>For our site we will use <a href="http://css.maxdesign.com.au/listamatic/vertical10.htm" target="_blank">List 10 by Mark Newhouse</a>. Our CSS will be:</p>
<div>.moduletable-leftnav{<br />
margin-bottom:1em;<br />
padding:0; /*the padding is removed so the menu fills the whole module box*/<br />
border:1px #CCC solid;<br />
}<br />
.moduletable-leftnav h3{<br />
background:#666;<br />
width:100%;<br />
color:#fff;<br />
padding:0.25em 0;<br />
text-align:center;<br />
font-size:1.1em;<br />
margin:0;<br />
/*now we have no padding in the module, we don&#8217;t need the negative margins*/ border-bottom: 1px solid #CCC;<br />
}<br />
#navcontainer{<br />
padding:0;<br />
color: #333;<br />
}<br />
#navcontainer ul{<br />
list-style: none;<br />
margin: 0;<br />
padding: 0;<br />
}<br />
#navcontainer li{<br />
border-bottom: 1px solid #ccc;<br />
margin: 0;<br />
}<br />
#navcontainer li a{<br />
display: block;<br />
padding: 3px 5px 3px 0.5em;<br />
border-left: 10px solid #333;<br />
border-right: 10px solid #9D9D9D;<br />
background-color:#666;<br />
color: #fff;<br />
text-decoration: none;<br />
}<br />
html<br />
width: auto;<br />
}<br />
#navcontainer li a:hover,a#active_menu:link,a#active_menu:visited{<br />
border-left: 10px solid #1c64d1;<br />
border-right: 10px solid #5ba3e0;<br />
background-color: #2586d7;<br />
color: #fff;<br />
}</div>
<div>
<h3>Designer&#8217;s Tip</h3>
<p>When trying to get a particular menu to work, here is a useful tip. Create a default Joomla installation and then look at the code that is the mainmenu. Copy and paste this code into an HTML editor (like Dreamweaver). Replace all the links by &#8220;#&#8221; and then you can add CSS rules until the effect you want is acheived. The code for the menu to create the style is shown below:</p>
<div>&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221;<br />
&#8220;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;</a><br />
&lt;html xmlns=&#8221;<a href="http://www.w3.org/1999/xhtml&#8221;" rel="nofollow">http://www.w3.org/1999/xhtml&#8221;</a><br />
&lt;head<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=iso-8859-1&#8243; /<br />
&lt;title<br />
&lt;style type=&#8221;text/css&#8221;<br />
&lt;!&#8211; .thisisyourCSS {<br />
/* put a rule here*/<br />
} &#8211;<br />
&lt;/style<br />
&lt;/head</p>
<p>&lt;body</p>
<p>&lt;div<br />
&lt;h3<br />
&lt;ul id=&#8221;mainlevel&#8221;<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;li<br />
&lt;/ul<br />
&lt;/div<br />
&lt;/body<br />
&lt;/html</p>
</div>
<p>Note the CSS is <strong>embedded</strong> rather than linked to make editing easier.</p>
</div>
<h2><span style="color:#0000ff;">Hiding Columns</span></h2>
<p>So far we have our layout such that we always have three columns, regardless of whether there is any content in there. We want to be able to &#8220;turn off&#8221; a column automatically, or &#8220;collapse&#8221; it if there is no content there.</p>
<p>The simplest way to do this is to have a small piece of PHP in the &lt;head of the page.</p>
<div>&lt;?php if ( mosCountModules( &#8216;right&#8217; ) &lt;= 0) { ?<br />
#main-body {width:100%;}<br />
#content{width:75%;}<br />
#sidebar{width:25%;}<br />
#sidebar-2:display:none;}<br />
&lt;/style<br />
&lt;?php } ?</div>
<p>mosCountModules will return the number of modules in that location. If it is equal or less than zero, i.e., there is nothing there, then the style rules will be adjusted. This php must appear AFTER the line that links to the template_css.css file. This is because if there are two identical CSS style rules, the one that is last will overwrite all the others.</p>
<p>This can also be done in a simliar fashion by having the if statement import a sub CSS file.</p>
<h3>Hiding Module Code</h3>
<p>When creating collapsible columns, it is good practice to set up the modules to also not be outputted if there is no content there. If this is not done the pages will have empty &lt;div&#8217;s in them which can lead to cross browser issues.</p>
<p>To hide the empty &lt;divif statement is used:</p>
<div>&lt;?php if (mosCountModules(&#8216;left&#8217;)) { ?</div>
<p>Anything can be placed inside the if statement, so we can put our &lt;div there:</p>
<div>&lt;?php if (mosCountModules(&#8216;left&#8217;)) { ?<br />
&lt;div id=&#8221;sidebar&#8221;<br />
&lt;div<br />
&lt;?php mosLoadModules( &#8216;left&#8217;, -2 );?<br />
&lt;/div<br />
&lt;?php } ?</div>
<p>Using the above code, if there is nothing published in left, then #sidebar will not be outputted.</p>
<p>Conditional statements can also be used. Our sidebar column also had user1 in it as well as left, so we can have an OR statement:</p>
<div>&lt;?php if (mosCountModules(&#8216;left&#8217;) || mosCountModules(&#8216;user1&#8242;)) { ?<br />
&lt;div id=&#8221;sidebar&#8221;<br />
&lt;div<br />
&lt;div id=&#8221;navcontainer&#8221;<br />
&lt;?php mosLoadModules(&#8216;user1&#8242;,-2);?<br />
&lt;/div<br />
&lt;?php mosLoadModules(&#8216;left&#8217;,-2);?<br />
&lt;/div<br />
&lt;?php } ?</div>
<p>So if anything is published in either &#8220;left&#8221; or &#8220;user1&#8243; then this piece of code will be output.</p>
<p>Using this technique for our left and right columns, our index.php file now looks like this:</p>
<div>&lt;?php defined( &#8216;_VALID_MOS&#8217; ) or die( &#8216;Direct Access to this location is not allowed.&#8217; ); ?<br />
&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221;<br />
&#8220;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;</a><br />
&lt;html xmlns=&#8221;<a href="http://www.w3.org/1999/xhtml&#038;#8221" rel="nofollow">http://www.w3.org/1999/xhtml&#038;#8221</a>; lang=&#8221;&lt;?php echo _LANGUAGE; ?<br />
&lt;head<br />
&lt;?php mosShowHead(); ?<br />
&lt;script type=&#8221;text/javascript&#8221;<br />
&lt;!&#8211;<a href="http://www.bluerobot.com/web/css/fouc.asp&#8211;" rel="nofollow">http://www.bluerobot.com/web/css/fouc.asp&#8211;</a><br />
&lt;link href=&#8221;/templates/&lt;?php echo $cur_template; ?<br />
&lt;?php if ( mosCountModules( &#8216;right&#8217; ) &lt;= 0) { ?<br />
&lt;style type=&#8221;text/css&#8221; media=&#8221;screen&#8221;<br />
#main-body {width:100%;}<br />
#content{width:75%;}<br />
#sidebar{width:25%;<br />
#wrap{background:none;} &lt;/style<br />
&lt;?php } ?<br />
&lt;/head</p>
<p>&lt;body</p>
<p>&lt;div id=&#8221;wrap&#8221;</p>
<p>&lt;div id=&#8221;header&#8221;<br />
&lt;h1<br />
&lt;/div</p>
<p>&lt;div id=&#8221;main-body&#8221;</p>
<p>&lt;div id=&#8221;content&#8221;<br />
&lt;div<br />
&lt;?php mosLoadModules(&#8216;top&#8217;,-2);?<br />
&lt;?php mosMainBody(); ?<br />
&lt;/div</p>
<p>&lt;?php if (mosCountModules(&#8216;left&#8217;) || mosCountModules(&#8216;user1&#8242;)) { ?<br />
&lt;div id=&#8221;sidebar&#8221;<br />
&lt;div<br />
&lt;div id=&#8221;navcontainer&#8221;<br />
&lt;?php mosLoadModules(&#8216;user1&#8242;,-2);?<br />
&lt;/div<br />
&lt;/div<br />
&lt;?php } ?</p>
<p>&lt;/div</p>
<p>&lt;?php if (mosCountModules(&#8216;right&#8217;)) { ?<br />
&lt;div id=&#8221;sidebar-2&#8243;<br />
&lt;div<br />
&lt;?php mosLoadModules(&#8216;right&#8217;,-2);?<br />
&lt;/div&lt;?php } ?</p>
<p>&lt;div id=&#8221;footer&#8221;<br />
&lt;?php mosLoadModules(footer,-2);?<br />
&lt;/div</p>
<p>&lt;/div<br />
&lt;/body<br />
&lt;/html</p>
</div>
<p>I have also suggested a change to the footer at this point. The footer.php include makes it very difficult to change what this text is. I much prefer to have this placed as a module. There is even a module location called footer! Note in the template file that is associated with this guide, I have <strong>not</strong> changed this footer code in the downloadable template, but I show here giving the option should you wish to do so.</p>
<div>
<h3>Designer&#8217;s Tip</h3>
<p>There are several names associated with modules in Joomla: banner, left, right, user1, footer etc. One important thing to realize is that the <strong>names do not corrospond to any particular location</strong>. The location of a module is completely controlled by the template designer, as we have seen. Its customary to place them in a location that is connected to the name, but not required.</p>
</div>
<h2><span style="color:#0000ff;">Conclusion</span></h2>
<p>This tutorial goes through the steps of creating a joomla template. The template uses cascading style sheets (CSS) to produce a layout with minimal use of tables. This is a desirable goal as it means that the template code is easier to validate to World Wide Web Consortium (W3C) standards. It will also tend to load faster, be easier to maintain and perform better in search engines. The template also is source ordered for optimal performance in SEO.</p>
<p>The template used in this tutorial can be found in the release of Joomla 1.1</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blakesabbath.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blakesabbath.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blakesabbath.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blakesabbath.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/blakesabbath.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/blakesabbath.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/blakesabbath.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/blakesabbath.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blakesabbath.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blakesabbath.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blakesabbath.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blakesabbath.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blakesabbath.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blakesabbath.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blakesabbath.wordpress.com&amp;blog=11581950&amp;post=3&amp;subd=blakesabbath&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blakesabbath.wordpress.com/2010/01/22/joomla-1-0-tutorial-make-custom-template/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/58b5e20e84e1012c06a7b7af10d5bb34?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">blake</media:title>
		</media:content>

		<media:content url="http://www.joomlashack.com/images/stories/tuts/template_examples.png" medium="image">
			<media:title type="html">template1</media:title>
		</media:content>

		<media:content url="http://www.compassdesigns.net/images/stories/articles/w3cvalidwebsiteoverlap.png" medium="image">
			<media:title type="html">template2</media:title>
		</media:content>

		<media:content url="http://www.compassdesigns.net/images/stories/articles/OfficialJoomlaTemplateGuide/1stversion.png" medium="image">
			<media:title type="html">template3</media:title>
		</media:content>

		<media:content url="http://www.compassdesigns.net/images/stories/articles/OfficialJoomlaTemplateGuide/2ndversion.png" medium="image">
			<media:title type="html">template4</media:title>
		</media:content>

		<media:content url="http://www.compassdesigns.net/images/stories/articles/OfficialJoomlaTemplateGuide/newmenu.png" medium="image">
			<media:title type="html">Template6</media:title>
		</media:content>

		<media:content url="http://www.compassdesigns.net/images/stories/articles/OfficialJoomlaTemplateGuide/menuoptions.png" medium="image">
			<media:title type="html">Template7</media:title>
		</media:content>

		<media:content url="http://www.compassdesigns.net/images/stories/articles/OfficialJoomlaTemplateGuide/modulesuffix.png" medium="image">
			<media:title type="html">template8</media:title>
		</media:content>
	</item>
	</channel>
</rss>
