International Sites:





/ PORTUNITY.INFO /


The First Template

The creation and administration of templates is very easy. In the Portalsuite Administration Center you find the template editor, below the menu icon “templates“.


The creation and administration of templates is very easy. In the Portalsuite Administration Center you find the template editor, below the menu icon "templates". After choosing the menu item all templates stored in the Portalsuite are indicated on the left. In the Light version you merely get a template list, from the Advanced version on you have also the possibility to group your templates with template sets. Therefore the left area is bipartite in the Advanced and in higher versions. At the top you find the template sets and bottom the respective templates. Normally in case of a new portal there are no templates yet, eventually templates have already been copied through portal templates.


Now let’s create the first simple template. To do so, please choose the function "Apply New Template". In the middle, right from the template list, now the template editor appears.


Enter an arbitrary template name. The following two settings define a term under which this template shall be used by the Portalsuite. Define the template type as "overview template" and set the category mapping to "Standard". Please just put up with these two settings for this first test template. We will cater to their specific function later.


Now you can enter HTML code into the area in the middle. Enter the following simplex HTML code:




<html>
<head>
</head>
<body bgcolor=#ffffff>
This is a test template.
</body>
</html>


 


Save this template with the save-button on the right and choose the preview icon from the menu above afterwards.


You see a relatively unspectacular "normal" HTML page in the preview window. If you let the source code of this page be indicated, you will see that it corresponds exactly with your template HTML code: Depending on the browser you get to the source code best via the context menu of the right mouse button.


Now please go back into the template and change the HTML code as follows:




<html>
<head>
</head>
<body bgcolor=#ffffff>
This is a test template.<br>
<? PrintPSVersion(); ?>
</body>
</html>


 


Afterwards you call the preview function again. Besides you can, depending on the browser, also open the preview function in a new window at the Portalsuite menu icons via the right mouse button. Then you have got the preview in the one window and can return to the template in the other window and stay there. In this context the convenience functions of the Portalsuite 2002 Advanced should be mentioned: through the adopt-button you can experiment even easier.


Now you can see that the Portalsuite has output the current version of your Portalsuite installation in the second line. Namely exactly at that place, where the command <? PrintVersion (); ?> was before. However this command is not visible anymore in the source code of the preview.


This is one of the template commands the Portalsuite, provides. In order to signal the Portalsuite resp. the PHP interpreter, where it is about commands in PHP and where it is about normal HTML code, the two tags "<?" and "?>" are used. "<?" switches to PHP which means that everything that stands behind this tag is interpreted and executed by PHP. "?>" ends the PHP mode again which means that everything that stands behind this tag is not considered or executed. You can call one or several commands resp. functions within a PHP section defined like this. Each command has to be concluded by a semicolon.


Like there are parameters in HTML tags which determine formatting and appearance, thus ultimately control the browser interpreter blow-by-blow, there is the possibility also in the Portalsuite resp. PHP functions to provide specific instructions for the command resp. the function within the templates by parameters. Try the following code:




<html>
<head>
</head>
<body bgcolor=#ffffff>
This is a test template.
<? echo ("Hello World !"); ?>
</body>
</html>


 


The command "echo" is defined by PHP and outputs a text passed as parameter. If you again take a look at the output, you will see that also in this case there is nothing visible left of the virtual PHP command. Surely you will wonder why there is a command like "echo", after all one could output the text directly in HTML code. Yet the echo-command becomes useful in combination with other commands like, for instance, the "date"-command. The date-command returns the current date and time (Annotation: no output !). The returned value then can be output with the command echo. But in turn also the date-command has got an optional parameter With this parameter you define which and how as well as by which order the Portalsuite resp. the PHP interpreter shall indicate date and time variables. The parameter from the example says that we want to output the day, followed by a dot, then followed by the month and again followed by a dot and finally followed by the year. Such a nested construction appears as follows:




<html>
<head>
</head>
<body bgcolor=#ffffff>
This is a test template.
<? echo (date ("d.m.Y")); ?>
</body>
</html>


 


Please note that the date-command is not enclosed by quotation marks, since it is not about a string but a command. This nested PHP instruction is not visible anymore in the output, instead of the command the current date appears in the source code:


Picture 4: Preview function showing the output of the third test template with the "echo" and the "date"-function as well as the source code view


Continue to recommend this article:

Your Name:

Your eMail-Adress:

eMail of Recipient:

Additional text:







Direct links to the new Portalsuite 2002:

- Productinfos
- Download

- Support overview
- Support forum