[since Version 3.1, R1956, 17th June 2010] Before a template is deleted with , the data pool may be queried if this is allowed. The required statement for this is stored in
Panelstatement 118
The stament may be a database command (for SOAP, SOAP commands are also allowed) or a cScript.
Selects and SOAP statements contain a question mark ? which is replaced by the template ID. Exactly one result column of type string is expected, see here.
The following statement forbids deleting any templates.
select "beep" from pageitems where id = ?
The check to determine if a template may be deleted is usually very complex. Therefore, you can also use cScript to make the checks more involved. In any case, you have to set the return variable gResult (of type char[5000]) to one of the values described below, if the deletion should be prevented. The following global variables are defined in the script:
Variable | Type | Description |
gRecordID | int | ID of the Template |
gRecordStringID | char* | Name of the Template, !readonly! |
gResult | char[5000] - Return value | The meaning of the valid values can be taken from the table Result String |
This example script forbids deletion of templates with uneven IDs.
int main () { if (gRecordID % 2) sprintf ( gResult, "Uneven Templates (%d) may not be deleted.", gRecordID ); return 0; }
Result String | Description | |
Empty, NULL, or no result found | The template may be deleted | |
"beep" | The template may not be deleted. | The failure to delete is communicated with a beep sound. |
"no_message" | The deletion attempt is ignored | |
other | The message is shown in a warning dialog. |
Continuation frames are used when at least one text of a template has an overset after load, but the product (possibly with a mofified frame) should be continued.
The template may, for example, contain a table that could get so tall that it does not fit on a single page. Next to the table, a product image should be displayed. How do you get this image onto the next page?
To use continuation templates, you have to do three things:
If the template contains a frame that should continue, which has an overset after load, that frame is first set to its maximum height within the templaate.
If the current page element checks the size of inserted frames, the text frame is resized such that the page element is filled maximallyl. If the page element should not perform that check, the current template grows up to the bottom page boundary. In either case, overset is checked again after the resize.
If the overset could be removed successully, the frame size is adjusted to the content. If there is still overset after the resize, the continuation template is loaded and product continuation is attempted. The text frame with overset is automatically linked with the corresponding frame in the continuation.
The new template is placed in the next possible page element of the product build. If no viable element is found, a new page is created, as if the list of products to build contained another entry that should be processed now.
Like other templates, continuation templates are allowed to create new pages. Read more about this here.
If a frame's overset should be checked during page build can be specified in the frame properties (see here). You can mark any text frame as a continuation frame. If text frames are located below each other, only the upper-most frame is allowed to grow. Lower frames keep their size. Frames located beside each other can grow independently.
When changing a text frame's size, frames below have to be relocated downwards. To keep the distances in place, you have to define appropriate magnets between the frames. Do not forget, however, to fixate the opposite edge with a nail!
The linking of textframes between template and continuation is of course automated. You must however specify which frames should be linked with each other. For that, there's the frame identifier, which can be set in the frame properties. If two frames with the same identifier can be found in the template and continuation, these frames will be linked.
Any unicode character can servve as an identifier. Depending on which fonts are installed on you machine, some characters may not be displayed properly, though.
The unicode identifiers are also used to determine the order in which a template's layout rules are applied.
If the frame in the continuation is no text frame, it is converted to a text frame. Any images in the frame are deleted in the process.
Text links can only be set between two frames at once. You should make sure to only use the identifier of the frames you would like to link only once each. To spare you constant annoyance by warnings, the identifiers are not checked.
Templates can contain subtemplates for left and right pages and for continuations. To create a template group, follow these steps:
[since Version 3.2.3 R2568] If a template is used during text flow builds, you can also set the delimiting text that a product gets from the template. You can specify two different delimiters :
You can use predefined delimiters (spaces, paragraphs), fixed texts (even TaggedText), or script generated texts. The setting can be changed in the template dialog in the region Textflow-Prefix.
To use this feature, the data model has to be extended,, read more about this here.
Delimiters can be generated by scripts. This allows specific delimiters depending on page template and element, template, page and product.
Delimiter scripts, lika other scripts, are defined in actions and have the ClassID 46. The following global variables are defined in addtion to the usual gRecordID, ..., gFrame, ...:
Variable | Type | Description |
gPageNum | int | current page number (1 based) |
gTemplateID | int | current template |
gTemplateName | char* | |
gPageTemplateID | int | current page template |
gPageTemplateName | char* | |
gElement | int | current page element |
gElementName | char* | |
gParam1 | char* | User defined text from the "Template Sttings" |
gPrefix | char* | Result String, 5000 characters max. Fill this string with the desired prefix text. |
The first product is prefixed with a 1. Keep in mind: If the new paragraph should have a different paragraph style than the current text end, you have to explicitly set a paragraph style: If the delimiter is inserted before the product, its paragraph style if not yet known. If the delimiter is inserted after the product (which is possible in principle), the new product text's first paragraph gets the paragraph style from the current text end.
int main () { sprintf (gPrefix, "%%!TT<ParaStyle:Titel>1. "); return 0; }
For all other products start with a new paragraph and are counted. A placeholder (11 in this example) is used for counting, which is used only once per round.
int main () { LinkList lli = linklist::alloc (); linklist::text_collect (lli, gFrame, 0, -1, 1, 11); sprintf (gPrefix, "%%!TT<ParaStyle:><ParaStyle:Titel>%d. ", linklist::length (lli)+1); return 0; }
[Since Version 3.2] The panel Template behaviour shows the template-relevant data of the current frame selection or Comet Group.
The list automatically is adjusted to the current document selection. Conversely, entries in the list may be selected via the document frames. The list is sorted by template kind (left, right, continuation) and by the frames' sequence numbers.
Three possible selections are distinguished:
If at least one frame in the current document selection shows its template behaviour, all frames on the page belonging to the same template are shown. The list's heading is set to the template name and displayed in orange.
Group membership is implemented with internal marking in the frame. The marking cannot be affected. It consists only of the user name and the current data and time. The marking is updated when saving a template, or when creating the mirrored (and continuation) frames with the mirror button in the panel (). When creatin frames via copy and paste, the marking persists.
If no frames in the selection show their template behaviour, but all frames belong to the same comet group, all frames in the comet group are shown. After the name of the comet group (i.e. its ID), the name of the template that inserted the frames into the document, is shown. If the frames were not inserted by template, this part remains empty. If multiple templates were used, all template names are shown.
The list heading contians the comet group ID and the template name/s:
If no frame in the selection shows its template behaviour, and the frames belong to no (or multiple) comet groups, the current frame selection is shown.
The list heading in that case:
Button | Description |
Create the mirrored frames. Only the positions are mirrored, not the frames themselves. Alt Key : Hold the shift key to also create the frames for the continuation. Text frames with no other text frames below them are automatically marked as continuation frames. |
|
Show and Hide template settings of the selected document frames. Alt Key : Hide for all frames in the documents. |
|
Change the Sequence Number | |
Change the Identifier | |
Select all frames in the list with the same identifier as the first selected entry. |
What do the entries in the panel show?
Column | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 | In a rectangle with the same proportions as the current document page, display the approximate position and size of the frame on the page. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2 |
Identifier of the frame and type of the template. Change the identifier like this. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3 (top) | Frame type and ID | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3 (bottom) | Image path or text opening (where available) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4 |
Additional frame properties. The properties can be changed by mouse click.
|
Order, label and continuation type of the frames can be shown in the document.
How to turn on and off the template behavior on frames:
If a template is opened by double-clicking, the template behavior of all frames is visible automatically.
The order of the frames in the panel Template behavior determines the sequence in which the frames can be processed in Product Building and Reorganization. In Text Flow Builds the order determines in which order the frames (or their contents) are inserted into the current text. The sequence number is highlighted in black at the bottom of the frame:
To change the order, use the buttons and in the bottom left corner of the panel.
Please note: If you turn existing frames into templates, the frames may have no different sequence numbers yet. Please check if the sequence numbers of the frames are fixed for new templates. If the Sequence numbers not yet defined, click at least one of the following buttons or .
The Label is an identifiaction code and gives a frame a unique and permanent identification within the template resp. its Comet Group. Please note that the identifiers must remain unique even after product build-ups. Any frames added during the construction must therefore each be given further and different identifiers. To set the frame label you can use the frame::set_smart_item_data function.
The label consists of a single Unicode character and can be found in the Label field in the panel Template Behavior. The label is highlighted in red at the right top of the frame:
Labels are used in the following situations:
If you do not require any of the above functionalities, the label can be omitted. But if you assign labels, you must make sure that the labels are unique inside Comet Grous!
Templates can create new pages or skip to the next page element. When a jump to the next element is attempted (setting ) and the build is on the last page element, a new page is created automatically and the build is continued on its first element.
This setting can be made on any frame in the group. For better visibility, the small image is stored in every frame in the group in the first line in the list Template Behaviour, highlighted in green. The same color is used in the preview of the template in the Templates panel.
For the "Next Page Element" property, you need at least v4.0.5 R9730.
Too create new pages, the Table/file framerules has to be defined in the data pool.
The Table/file framerules was introduced in Comet 2 to support the Layout Rules panel. This panel has become obsolete in Comet 4. framerules is still required for the template behaviour "New Page/Next Page Element", however.
[since v3.3 R2688, 28.10.2011]
Page build and reorganization have to check in different places, whether existing page content is overlapped. In that case, the next free location is searched based on the settings of the page template and element.
A new product does not have document frames that could be checked, though. Thus the bounding box of the template frame during template saving is used. That box is visualized in the Templates panel:
In some circumstances the bounding box test is not precise enough, so you may want to use the actual frame edges for textin. In the image, the text of the predecessor product should be allowed to reach into the free space of the star. The usual bounding box test would fail here.
You can specify for each frame in the template, which area should be tested for overlap, whereby :
and are not supported in 1:N elements - the build checks if a template can occupy a space; it does not check where it might be placed. This is a rarely encountered problem with relatively high mathematical complexity, which we will gladly solve for you on request.
In XML and SOAP, the elements pageitems.pageitem each have to be extended with the hasShapes element. Each entry gets the value 0.
Here an example for an extended pageitem element:
<pageitem>
<id>1199</id>
....
<hasShapes>0</hasShapes>
</pageitem>
<pageitem>
The required information about the frame edges and gaps are simply stored next to the template file with the extension shapes. The Shapes-file is automatically written when saving the template.
In SQL the table pageitems has to be extended with the attribute shapes of type CLOB/text.
Here the required SQL statement for a mySQL data base:
alter table pageitems add shapes text;
The feature will be available after the next connection to the extended data pool. You should then see the following line in the logfile after login:
# Support page item shapes : yes