htmlHead
Page head class
[Previous] [Main] [Next]


Description
htmlHead encapsulates the page <HEAD></HEAD> tags. It is used internally by the htmlPage class, which provides the htmlPage::Head() method for direct access, so it's not normally necessary to instantiate htmlHead objects directly.  
 
The <HEAD> tag area of a page contains descriptive infromation about the document, such as the title. It can also contain other attributes, such as <META> information often used to describe document contents for search engines.  
 
When rendered with a browser, the document title doesn't actually appear in the document itself. Instead, the title appears in a separate area in the browser's program area, typically as a window caption. Only one title is allowed per document, and it's length should be less than 64 characters in order to display properly on most browsers. The title may not contain paragraph tags or highlighting of any kind.  
 
Declaration
#include <dcmicro/htmlpp/head.h>  
 
Hierarchy
htmlhead.gif  
 
See Also
htmlPage, htmlBody, htmlMeta  
 
Related Constants/Definitions
None.  
 
Constructors
htmlHead()  
Constructs an empty head object.  
 
htmlHead( const String& title )  
Constructs a head object, setting the page title to title.  
 
htmlHead( const htmlHead& rhs )  
Copy constructor.  
 
Destructors
virtual ~htmlHead()  
Destroys the object.  
 
Member Methods
=   htmlHead& operator= ( const htmlHead& rhs )  
Replaces the contents with rhs and returns a pointer to the object.  
 
Title   htmlHead& Title( const String& title )  
Sets the title to title, then returns a reference to the object.  
 
Title   String Title() const  
Returns the title as a string.  
 
Print   void Print( ostream& os ) const  
Outputs the object to os.  
 
ClonehtmlObject FAR * Clone() const  
Returns a base-class pointer to a deep copy of the object.  
 
Example Use
 
#include <stdio.h>  
#include <stdlib.h>  
#include <dcmicro/htmlpp/htmlpp.h>  
 
int main( void )  
{  
   htmlCgi   server ;  
   htmlPage  page( "html++ example application" ) ;  
 
   //  Create a meta information object  
   //  containing a description of the document.  
   htmlMeta  m ;  
   m.Description( "Descriptions placed here can be "  
             "used by search engines to identify "  
             "and index your pages." ) ;  
 
   //  Meta information objects must be placed  
   //  in the head area of the page.  
   page.Head() << m ;  
 
   page << "Meta information in the <HEAD> section "  
          "does not display, but can be seen "  
           "by search engines." ;  
 
   server << page ;  
   return 0 ;  
}  
 
Program Output
 
Content-Type: text/html  
<HTML>  
<HEAD>  
<TITLE>html++ example application</TITLE>  
<META name="description" content="Descriptions placed here can be used by search engines to identify and index your pages.">  
</HEAD>  
<BODY>  
Meta information in the &lt;HEAD&gt; section does not display, but can be seen by search engines.  
</BODY>  
</HTML>  
 
head.gif  
 
 


©1998 DC Micro Development. All rights reserved.
No portion of this document may be c opied or reproduced without expressed written consent.
html++ is a trademark of DC Micro Development.