iphlex systems templates and text replacement
iphlexwebphlexdocumentation > templates and text replacement
show contents
hide contents

 

top of page
text replacement codes

The templates contain text replacement codes, which start and end with the character #. When the page group is generated or previewed, they are replaced by their actual value.

A simple example: the template for this page starts like this:

<HTML>
<HEAD>
<TITLE>#TITLE1#</TITLE>
</HEAD>

and after generation it becomes...

<HTML>
<HEAD>
<TITLE>templates and text replacement</TITLE>
</HEAD>

Text replacement codes are not case-sensitive.

Many replacement codes can be modified by parameters, to put the retrieved text into upper or lower case, limit its length, add or remove HTML codes, etc.,

e.g. #TITLE1|UCASE# TEMPLATES AND TEXT REPLACEMENT

see also:

top of page
local text replacement codes

N.B. most of the examples below are based on the page you're looking at.

The text replacement codes based on data from the current page group are known as local text replacement codes. These include:
 
data which is fixed for the entire page group,
e.g.  number of (main) pages #NUMBER_OF_PAGES# 2
date content last updated #DATE_LAST_UPD# 13-09-2004
main mail address #MAILTO# nospam@iphlex.com
 
data which changes per page,
e.g.  page number #PAGE_NUMBER# 2
page title #PAGE_TITLE# text replacement
 
page group data which can vary per language (most page group data falls into this category),
e.g.  language code #LANG_CODE# ENG
language description #LANG_DESC# English
page group title #TITLE# templates and text replacement
 
data which changes per element (and often also per language),
e.g.  element text 3 #ELEMENT_TEXT3# local text replacement codes
 
Replacement codes can also be used to retrieve values from the first, last, previous and next page or element:

e.g.  the title of page one #First:PAGE_TITLE# templates
the number of the previous page #Prev:PAGE_NUMBER# 1
 
The URL of an extra page can be retrieved using the extra page code. For instance, in the example page group *lanz1, the location of the index page for big pictures (code "index_big_"), would be retrieved using the replacement code #xPAGE:index_big_#.

e.g.  relative address of extra page "index_big_"
for main page 1
(from within page group '*lanz1')
#xPAGE:index_big_# index_big_1.html
 
The #xPAGE: replacement code will return the URL of the extra page corresponding to the main page or detail page being processed, but it is also possible to find the URL of the first, last, previous or next page by using the codes beginning with #FIRST_xPAGE:, #LAST_xPAGE:, #PREV_xPAGE: and #NEXT_xPAGE: respectively.

For a complete list of the local replacement codes available in a given situation, use the button 'view replacement codes'click for more information about this button ).

see also:

top of page
system-wide text replacement codes

(click here for a complete list of the system-wide replacement codes.)

Text replacement codes can also be based on data from outside the current page group. These are known as system-wide text replacement codes.
 
To retrieve data from another page group, the code or number of the page group is included in the replacement code. To use the page title 1 from the page group with code "*lanz1" (number -101), use code #wPAGE_TITLE1:*lanz1# or #wPAGE_TITLE1:-101#:

e.g.  page group title 1 #wPAGE_TITLE1:*lanz1# Lanzarote, February 2002
main file location #wPAGE_LOCATION:*lanz1# c:/webphlex/web demo/lanzarote/site1/
 
To retrieve the URL of an element within its page, use the element number. This number is unique throughout the system, so that any element which includes the text <A NAME=##ELEMENT_NUMBER#> (as do all the examples and default texts), can be accessed from anywhere in the system using its generated URL. For example, to use the URL of element number -1987 (this one), use code #ELEMENT_URL:-1987#:

e.g.  URL of element on this page #ELEMENT_URL:-1987# #-1987
URL of element on page 1 #ELEMENT_URL:-1990# text_replacement.html#-1990
URL of element in another page group #ELEMENT_URL:-2409# ../web demo/lanzarote/site1/index.html#-2409
 
Texts can be retrieved (in the current language) from a text block, using its code or number. To use the text from the text block with code "*pageLastUpd" (number -102), use code #TEXT:*pageLastUpd# or #TEXT:-102#:

e.g.  text block "*pageLastUpd" #TEXT:*pageLastUpd# Page last updated:
 
Text blocks can include local and system-wide replacement codes:

e.g.  text block "*page n / x" #TEXT:*page n / x# Page #PAGE_NUMBER# / #NUMBER_OF_PAGES#
page 2 / 2
 
Text blocks can even include other text blocks:

e.g.  text block "*pageLastUpd:DATE#" #TEXT:*pageLastUpd:DATE# #TEXT:*pageLastUpd# #DATE_LAST_UPD#
Page last updated: 13-09-2004

In these codes a numeric value is interpreted as a key number, and a non-numeric value as a code. However, a code which happens to be completely numeric can be used by putting it between quotes.

Click here for a complete list of the system-wide replacement codes.

see also:

top of page
language text replacement codes

During the replacement of both the local and system-wide replacement codes, wherever the result is language dependent it will be based on the language currently being generated. It is also possible to retrieve information on the current language directly:
 

e.g.  the language code, using code NL (Dutch) as an example #LANG_CODE# NL
the language extension for filenames #LANG_EXT# _NL
the language description #LANG_DESC# Nederlands

N.B. the language extension for filenames will always be empty for the default language.

If the indicator 'force lower case in filenames?' is set (control panel > web pages > web page groups), then the language extention will automatically be in lower case.

see also:

top of page
previewing local text replacement codes

At various places in the page group screen, you'll see a button for previewing all the available local text replacement codes click for more information about this button ). A temporary output file is created containing the replacement codes available, along with the values with which they would be replaced if the current record were being generated.

Clicking this button on the main page will show data which changes per main page (e.g. main page URL, page title), whereas clicking it on the detail page or element will show data which changes per element (e.g. element title, destination URL). Data which is fixed for the entire page group (e.g. page group URL, number of pages) is always shown.

Note that this procedure retrieves a large number of codes, including all available codes for the first, last, previous and next elements / detail pages, plus those for the parent page group if one exists, whereas these codes are normally only retrieved as and when they are actually used. This means that, for a large or complex page group, viewing the replacement codes can be a time-consuming process. It is also possible that situations can arise (e.g. text blocks calling themselves, attempts to use data which is not present) which will never occur when actually generating the page group or previewing parts of it, but which will result in error messages here. Just ignore these messages.

The window showing the generated text has a button ( ) allowing it then to be viewed in the browser if required.

see also:

top of page
iphlexwebphlexdocumentation > templates and text replacement Copyright © 2006 iphlex systems