Welcome to Welcome to

Current Location:
Templates
Templates

What are templates?

Templates are a sort of design pattern. They allow a programmer to develop programms (scripts, ... whatever) completely free of design. Or the other way, templates allow designers to design graphical user interfaces completely free of any programming language code. The only thing they have to use is a special kind of interface, the template's specifications.



What template system has been used in PHPrcon?

I used the template class of phplib. Phplib is a LGPL (Lesser GNU Public Licence) project downloadable at Sourceforge. It is a PHP script collection which inherits a lot of usefull tools for PHP development. For further information please read the phplib manual.



What does the PHPrcon template interface look like?

There are currently 7 private and 1 public page in PHPrcon. Every of these pages has its own template. The superior design is an additional template. These templates mainly consist of HTML code. The filenames end up with ".ithml". All information coming from PHPrcon scripts are stored in "variables" like {ROWSTYLE} or {FEEDBACK}. These static variables are filled with HTML content in runtime of the specific PHPrcon page. I call them static, because they are single components which can be placed anywhere on the page and they are not being repeated anyhow. Another kind of variables are dynamic variables. They are components like: (Example taken from servermaps.ihtml)
<!-- BEGIN dir --> <tr> <td class=row_border><br></td> </tr> <tr> <td class=row_head> <span class=descr>{TITLEDIR} {DIRECTORY}<br> <span style="font-size:12px">{SERVERMAPSCHANGEDESCR}</span> </span> </td> </tr> <!-- END dir --> Dynamic variables are used for complex changes on the webpage. For example, the repetition of a table row of player information or the exchange of helptexts through text of another language. The deeper meaning of using dynmanic variables or "dynamic blocks" to use static variables which may change their content through repetitions.

Variables that are used in that particular PHPrcon page will be filled in any case. If you do not want that content to appear on the page, just remove the static variable from the HTML code. If you do not want a dynamic variable to appear on the page, the interior of the block has to be left empty. It is strictly neccessary that the dynamic block is present in the HTML code. Otherwise strange error messages will appear in your browser.

Below is a detailed list of the static and dynamic variables of all the pages. Click on the template name to view the list.

· global variables        
· main.ihtml   Superior Design    
· serverinfo.ihtml   First page you see   "Server Info"
· servercommand.ihtml   Execute commands on Gameserver   "rcon Command"
· serverrules.ihtml   All Gameserver variables   "Server Rules"
· serverbanlist.ihtml   Ban/Unban of player WonID's   "Server Banlist"
· servermaps.ihtml   Gameserver map list   "Server Maps"
· serverconfig.ihtml   Edit Gameserver config files   "Server Config"
· help.ihtml   Helptexts for every section of PHPrcon   "Help"
· news.ihtml   News of PHPrcon   "News"
· publicinfo.ihtml   Additional page for public server info



How do I use the static and dynamic variables?

The static variables are quite easy to use. Just place the variable there, where you want to display its content. For example:

<table> <tr><td>Hostname</td><td>{HOSTNAME}</td></tr> <tr><td>TCP/IP</td><td>{TCPIP}</td></tr> <tr><td>Map</td><td>{MAP}</td></tr> <tr><td>Players</td><td>{PLAYERS}</td></tr> </table>
Hostname[hansA]Apachenpup
TCP/IP195.71.99.212:27017
Mapcs_office
Players2 active / 15 max
This is a simple example for an info box for a Gameserver. The output of the "Apachenpup" Server could look like that.


The use of dynamic variables is bit more difficult. Dynamic variables are specified as dynamic blocks. Some of the dynamic blocks are repeated several times, like the list of players on the "Server Info" page. Some of the blocks are simple dynamic content, like the page titles, or the language dependent parts of PHPrcon, like the "Send a command to the server" on the "Server Info" page. The dynamic block starts and ends with a HTML comment. <!-- BEGIN blockname --> The content of the dynamic block comes here. <!-- END blockname --> Start and end comment have to be exactly the same shown above. The blockname is the name of the dynamic variable. The blockname has to be exactly the name in the PHPrcon template, otherwise the dynamic block will simply NOT be dynamic. The dynamic block can be filled with whatever HTML stuff. The static variables are filled with new content every repetition. For example:

<!-- BEGIN playerlist --> <table> <tr> <td><b>{TITLENAME}</b></td> <td><b>{TITLEWONID}</b></td> <td><b>{TITLEADRESS}</b></td> </tr> <!-- BEGIN player --> <tr> <td>{NAME}</td> <td>{WONID}</td> <td>{ADRESS}</td> </tr> <!-- END player --> <!-- BEGIN connectingplayer --> <tr> <td colspan=3 style="color:#ff0000"> Connecting Player </td> </tr> <!-- END connectingplayer --> </table> <!-- END playerlist -->
NameWonIDAdress
Der Lui123456324.453.667.001:27015
Kasimir987343653.623.432.435:27015
Ch33tor2342143212.221.112.111:27015
Connecting Player
This is a simple example of the dynamic block "playerlist" of "serverinfo.ihtml" and how it would look like. The first row is shown everytime. The block "player" is displayed for every player that is active and not connecting on the gameserver. The block "connecting player" is displayed for every player that is currently connecting to the gameserver.


Where are the pictures and stylesheets for any theme?

The path to the templates is "{TEMPLATEDIR}". Within this path you can put your pictures and stylesheets ... whatever, wherever you want to. For example: <link rel=StyleSheet type="text/css" media="screen" href="{TEMPLATEDIR}/style.css"> <img src="./pics/logo.gif"> Have fun creating magnificent views. If you think your theme looks good, mail it to me. Maybe it will be in the next version of PHPrcon or in the additional theme pack that will be launched in near future. :)



Global Stuff
· News
· News Archive
· About
· Screenshots
· Team
· Thanks

Download
· Download
· Patches
· Themes

Documentation
· Installation
· Configuration
· Templates
· Development with PHPrcon

Fun Stuff
· Most Famous EMails

Contact
· Forum
· EMail

Last Update: 20 Mar 2003


Gamewarriors
SourceForge Logo