Displaying Linked Pages with Creator2 Using Page Fragments
Have you ever wanted to set up a linked table of contents in which the links go to specific parts of a web page? This article describes how to set up this functionality in Creator2 with HTML pages.
Displaying Linked Pages with Creator2 Using Page Fragments - Adding Page Fragments to the Project (Page 3 of 4 )
In a manner similar to adding pages you can add Page Fragments. When you pick Page Fragment from the drop-down menu shown earlier, you will see the following window pop up. You give a name to the Page Fragment and it gets added to the Web Pages Node.
In this manner three Page Fragments were added to the project called hdr.jspf, ftr.jspf, and nav.jspf for each of the sections header, footer and the ToC (Navigation) as shown in the project view.
Adding Page Fragments to the page
Each of these page fragments will be placed in the corresponding sections. In order to place the page fragments you need to drag and drop the Page Fragment Box control. A container for the Page Fragment is available in the Palette as shown.
When you drop the Page Fragment Box on the page, the following window pops up where you need to specify with which of the Page Fragments in your project you want this section to be associated. It is also possible to create a new Page fragment from this window.
When you drop a Page Fragment Box on the Header section and associate hdr.jspf with it, the source code for the header section changes as shown here. The generated code in the source file is shown in the next paragraph. The hdr file is just like the include file in the Active Server Pages.
<!--header goes in here-->
<div style="left:50px;width:500px;height:80px;top:10px;
background-color:silver;position:absolute">
<div style="position: relative"> <jsp:directive.include
file="hdr.jspf"/>
</div> </div>
<!--end of header -->
Contents of hdr.jspf file
It has just the 500 X 80 graphic element which is imported into the Resources folder of the project as shown.You can drag and drop the image file and it will be correctly formatted in the source view.
The ToC section has embedded in it the nav.jspf page fragment and the design view is as shown here. Although part of one of the links appears outside of the nav.jspf, the words will wrap in the final rendering. However, these details are important for correct design. The <ul/> has its own characteristics as to its default location and this has to be taken into consideration when placing elements.