|
In this example we create some HTML code, which will open a URL in a new window, as a Layer’s attribute value.
Normally we would select the Link field in Studio and check the checkbox to generate a hyperlink for the field. Studio currently doesn’t support the creation of a hyperlink for a new tab/window directly but it does provide an opportunity to see how html can be stored in a layer’s field.
The following steps presume that you're using a table in PostgreSQL but this can work for other sources such as a Shape file or MapInfo tab file.
Open PgAdmin, and use the SQL dialogue to create a column in your table.
ALTER TABLE mytable ADD COLUMN myhtml text; |
Populate the column with some HTML that includes the link with the target parameter.
UPDATE mytable SET myhtml = '<p><a href="http://www.google.co.uk" target="_blank" >Here is Google in a new window</a></p>'; |
Alter the SQL in the MapServer .map file to include the myhtml
column as myhtml_raw
- this will ensure that the HTML is passed through without alteration.
|
In Studio include myhtml_raw
to in the list of columns displayed.
Make sure you include the http:// in the myhtml column - failing to so will result in the browser attempting to load the page as a local resource. |