30 jun 2010

HTML5: area / map

areaimage-map hyperlink # T

The area element represents either a hyperlink with some text and a corresponding area on an image map, or a dead area on an image map.

Permitted content #

empty (void element)

Permitted attributes #

common attributes & alt & href & target & rel & media & hreflang & type & shape="rect" & coords or shape="circle" & coords or shape="poly" & coords or shape="default"

Descriptions for attributes specific to this element #

alt = normal character data
The fallback content for the image map.
href = URI
A URL that provides the destination of the hyperlink for this area.
target = browsing-context name or keyword
A name or keyword giving a browsing context for UAs to use when following the hyperlink for this area.
rel = tokens NEW
A list of tokens that specify the relationship between the document containing the area and the destination indicated by the area.
media = media-query list NEW
The media for which the destination of the hyperlink was designed.
hreflang = language tag NEW
The language of the destination of the hyperlink.
type = MIME type
The MIME type of the destination of the hyperlink.
shape = "rect" & coords = rectangle
Specifies that the shape of the area of this hyperlink on the image map is a rectangle.
shape = "circle" & coords = circle
Specifies that the shape of the area of this hyperlink on the image map is a circle.
shape = "poly" & coords = polygon
Specifies that the shape of the area of this hyperlink on the image map is a polygon.
shape = "default"
Specifies that the shape of the area of this hyperlink on the image map is a rectangle that exactly covers the entire image.

Additional constraints and admonitions #

  • The area element must have an ancestor map element.
  • The nohref attribute on the area element is obsolete. Omitting the href attribute is sufficient.

Tag omission #

The area element is a void element. An area element must have a start tag but must not have an end tag.

Permitted parent elements #

any element that can contain phrasing elements

DOM interface #

interface HTMLAreaElement : HTMLElement {
attribute DOMString alt;
attribute DOMString coords;
attribute DOMString shape;
stringifier attribute DOMString href;
attribute DOMString target;
attribute DOMString rel;
readonly attribute DOMTokenList relList;
attribute DOMString media;
attribute DOMString hreflang;
attribute DOMString type;

// URL decomposition IDL attributes
attribute DOMString protocol;
attribute DOMString host;
attribute DOMString hostname;
attribute DOMString port;
attribute DOMString pathname;
attribute DOMString search;
attribute DOMString hash;
};

Typical default display properties #

area {
display: none; }

Definition and Usage

The <map> tag is used to define a client-side image-map. An image-map is an image with clickable areas.

The name attribute is required in the map element. This attribute is associated with the <img>'s usemap attribute and creates a relationship between the image and the map.

The map element contains a number of area elements, that defines the clickable areas in the image map.

 Tips and Notes
Note: The area element is always nested inside the map element. The area element defines the regions in the image map.

Attributes

Attribute Value Description
name unique name Defines a unique name for the map tag, so it can be referred to.

Standard Attributes

The <map> tag also supports the Standard Attributes in HTML 5.

Event Attributes

The <map> tag also supports the Event Attributes in HTML 5.


26 jun 2010

Virtual hosts on Apache 2.2

Creando servidores virtuales en Apache 2.2


Apache 2.2 adopta una estructura modular para sus ficheros de configuración.
Así la definición de servidores virtuales la realizamos en un archivo externo extra/httpd-vhosts.conf.
Incluimos este archivo dentro del archivo de configuración principal httpd.conf.
También impone unas restricciones más severas en acceso que versiones anteriores, por lo que debemos configurar propiedades extra para conseguir acceso a los servidores virutales y no obtener el siguiente mensaje:

Forbidden

  • You don't have permission to access /index.php on this server.
Debido a estos permisos más estrictos, recomiendo crear un directorio raiz donde colgar nuestros servidores virtuales.


Suponemos que nuestro directorio de servidores virtuales es D:\vhosts.

Nota: Las restricciones de seguridad de Windows Vista y Windows 7 previenen el guardar datos en los archivos que mencionamos en estas instrucciones, incluso aunque estes logado como administrador.


  • Crear un directorio dentro de D:\htdocs para cada servidor virtual.
  • Abre C:\WINDOWS\system32\drivers\etc\hosts con tu editor de textos, y añade una línea como éstas por cada servidor virutal.


    127.0.0.1 localhost
    127.0.0.1 vhExample

  • Abre conf\httpd.conf en tu editor de texto y busca la sección #Virtual hosts ,y descomenta la línea
    #Include conf/extra/httpd-vhosts.conf
  • Abre conf\extra\httpd-vhosts.conf en tu editor de texto. La imagen muestra su típica estructura:

    Contents of   httpd-vhosts.conf
  • Al comienzo del archivo insertamos las siguientes líneas:
    <directory>
    Order Deny,Allow
    Allow from all
    </directory>


    Esto define los permisos correctos para el directorio que contiene los sites que queremos tratar como servidores virtuales.
    La ruta del archivo debe usar forward slashes e incluirse entre comillas si tiene espacios en blanco.
    Mientras que los servidores virutales estén en subdirectorios de este directorio raiz, tienen los permisos adecuados.
    Si hay varios directorios raiz, podemos crear diferentes directivas <directory> para ellos.
  • De los comandos que arriba se usan para definir un servidor virutal solo DocumentRoot y ServerName son obligatorias.
    Cuando usamos virutal hosting, Apache desactiva la raiz del servidor principal, así que nuestro primer servidor virutal debe replicar la raiz original del servidor.
    Luego añadimos tantos modulos virutalHost como servidores queramos definir, con su localización como DocumentRoot, y su nombre.
    Volvemos a usar forward slashes e incluir entre comillas si necesario.

    <VirtualHost *:80>
    DocumentRoot D:/htdocs/
    ServerName localhost
    </VirtualHost>

    <VirtualHost *:80>
    DocumentRoot D:/htdocs/vhExample
    ServerName vhExample
    </VirtualHost>

  • Guardamos los cambios en httpd-vhosts.conf, y reiniciamos Apache.
    Todos los sites configurados siguen siendo accesibles como http://localhost/sitename/.
    Además podemos acceder a cada servidor virtual de forma directa como http://vhExample/.
  • Si continuas teniendo problemas para acceder a los servidores virtuales, asegúrate de haber añadido la directiva DirectoryIndex en httpd.conf.