{PROJECT} ../../template/home_en.ini {GRAFIK_LINKS} $home/gifs/li_phpcms.gif {LOGO_1} $home/gifs/cmslogo1.gif {LOGO_2} $home/gifs/cmslogo2.gif {MENU} 00.08.10.12 {TITEL} PAX {CONTENT}
PAX offers a way to have PHP code in either your content file or template that differs from the use of the
{SCRIPT} method. With PAX turned on in the admin panel, templates and content files alike will
be preprocessed by the PAX module before being parsed by phpCMS. PAX strips PHP code from these files,
processes it and stores its results for later inclusion into the page after it has been parsed by phpCMS.
This ensures smooth operation of phpCMS and allows for further development of the PAX module without the need
for major modifications to phpCMS' core routines.
PAX works similar to the {SCRIPT} inclusion method that comes with phpCMS. {SCRIPT} allows you to include scripts into content files but not templates. PHP scripts included via {SCRIPT} are dynamically inserted into a page at runtime. While the static part of a page may be cached on the server (if caching is turned on in the admin panel), scripts are inserted into the page each time the page is requested. PAX works similar to {SCRIPT} inclusion as far as caching is concerned, but may be used to insert scripts into templates as well.
PAX is needed to include PHP into templates.
In addition PAX offers a variety of TAGS (PAXTAGS) that perform special tasks.
It is important to note that debugging is not available when including scripts via PAX!
Inclusion of PHP in templates is achieved quite easily and at your own risk:
Example:
<!-- PAXPHP name_of_code_block
echo 'Hello World!';
PAXPHP name_of_code_block -->
As you will see from the examples below, it is easy to include PHP code via PAX.
PAXTAGS add some interesting features to phpCMS.
With PAXINC you may include additional templates or external files (not! scripts) into your template or content files.
Note that within those templates/files included via PAXINC links are NOT being checked.
TAG:
PAXINC
SYNTAX:
<!-- PAXINC /path/from_root/to/template/or/file.html -->
or
<!-- PAXINC http://www.domain.net/data.html -->
Example:
<!-- PAXINC http://plugs.citroman.net/PAX/dokupaxtest.html -->
with PAXTAGS turned on will result in:
Of course, you may also use additional PAXTAGS within those templates/files you include via PAXINC.
PAXHIGHLIGHT prints out a syntax higlighted version of the code you included using the colors defined in the built-in syntax highlighter for PHP.
TAG:
PAXHIGHLIGHT
SYNTAX:
<!-- PAXHIGHLIGHT /path/from_root/to/template/or/file.php -->
or
<!-- PAXHIGHLIGHT http://www.domain.net/data.php -->
Example:
with PAXTAGS turned on you see the highlighted php source code of the file.
Mit PAXMENU gives you the ability to call on any menu class or field.
PAMENU is only fully supported in stealth-mode !
TAG:
PAXMENU
SYNTAX:
<!-- PAXMENU FIELDNAME,CLASS -->
simple example:
Suppose you wanted to create a link to a specific item of your menus within a template or file. This is how you would do it:
<a href="<!-- PAXMENU LINK,00.08.06.12 -->"><!-- PAXMENU MNAME,00.08.06.12 --></a>
This would create a link to the menu item with class 00.08.06.12. The link text would be what you have defined for MNAME for that menu.
Actual output with PAXTAGS turned on:
Example with "title" (for IE), target frame/window, and status message on mouseover:
<A HREF="<!-- PAXMENU LINK,00.08.06.12 -->" TARGET="<!-- PAXMENU TARGET,00.08.06.12 -->" onMouseOver="window.status='<!-- PAXMENU TEXT,00.08.06.12 -->';return true;" title="<!-- PAXMENU TEXT,00.08.06.12 -->"><!-- PAXMENU MNAME,00.08.06.12 --></a>
Actual output with PAXTAGS turned on:
In the above example the menu fields are as follows:
LINK and CLASS - these fields and their exact spelling are required by phpCMS, and may not be changed!
TARGET: the "target=" frame/window for LINK
TEXT: message to be displayed in the status bar on mouseover.
MNAME: the actual text that is turned into a link
Summing up you may call on any menu field, that has been defined in your .mnu file (the menu definition file).
Das Menü muss einen eindeutigen Namen tragen! Wenn ein Menü doppelt vorkommt (zb. SUB1), kommt es zu Fehlern bei der Darstellung!
Die Links werden grundsätzlich ausgehend von $home gesetzt!
PAXCOMBO funktioniert nur im non-stealth-mode einwandfrei!
TAG:
PAXCOMBO
SYNTAX:
<!-- PAXCOMBO MENUNAME,FIELDNAME,VALUES,SELECTED,SIZE,MULTI,ONCHANGE,FIRSTENTRY -->
MENUNAME | MENU:MAIN > hier wäre MAIN richtig. Darf in der Menüdatei nur ein mal vorkommen! |
FIELDNAME | Welcher Feldinhalt soll angezeigt werden? LINK, TEXT, NAME, usw... |
VALUES | optional - welcher Feldinhalt soll als Wert eingefügt werden. Ganz brauchbar für zb. automischen Linklisten. Wenn nichts angegeben, wird der Wert von FIELDNAME eingetragen. |
SELECTED | optional - welche Zeile des angezeigten Menüs soll den Focus erhalten |
SIZE | optional - Wie gross soll die Liste sein (in Zeilen) |
MULTI | (on/off) optional - Soll Multiselect erlaubt werden? |
ONCHANGE | (on/off) optional - Soll ein automatischer onselect bei eintragsaktivierung eingetragen werden? Praktisch für Linklisten |
FIRSTENTRY | optional - Text der als erster Eintrag angezeigt werden soll. zb: ~ select an entry ~ |
Beispiel:
<!-- PAXCOMBO SUB1, TEXT, LINK,, 1, off, on, ~ select your favorite ~ -->
ergibt bei aktivierten PAXTAGS:
TAG:
PAXLASTMOD
SYNTAX:
<!-- PAXLASTMOD d.m.Y - H:m:s -->
Beispiel:
<!-- PAXLASTMOD d.m.Y - H:m:s -->
ergibt bei aktivierten PAXTAGS:
zur Formatierung der Ausgabe werden die Werte die für den Befehl date verwendet werden, herangezogen.
Als DYNATAG bezeichne ich TAGS in der TAG-Datei, welche keinen normalen Text oder HTML-Code beinhalten, sondern jene TAGS denen PHP-Code zugeordnet wurde.
---------------
Beispiel für ein DYNATAG in der TAG-Datei:
Aktuelles Datum und Uhrzeit auf jeder Seite (Danke an Dirk)
Öffne Deine TAG-Datei und schreib ein neues TAG:
<ACTDATE>:= <!-- PAXPHP date $datum = date("d.m.Y"); $uhrzeit = date("H:i"); echo $datum," - ",$uhrzeit," Uhr"; PAXPHP date -->Nun kannst Du in jedem Template oder/und in ContentFiles einfach nur das DYNATAG <ACTDATE> angeben und Du hast immer das derzeitige Datum an der Stelle vom Platzhalter <ACTDATE>.
Within PHP code included via PAXPHP you have access to all global variables that were defined prior to the page being parsed by phpCMS/PAX. A list of global variable that are accessible can be found in the phpCMS documentation.
Note that not all global variables accessible to plug-ins are also accessible via PAX. So you may need to experiment a little. In the course of further development of PAX I will be constantly updating a list of these variables. You can find the list at http://plugs.citroman.net.
$PHP_SELF is also accessible via PAX. This way the execution of code, or the display of certain parts of the code, could be made dependant on the page that is being displayed.
Currently none known. If you stick to the general guidelines of phpCMS, PAX and PHP everything should work just fine.
Tips&Tricks&FAQ for PAX at plugs.citroman.net - BBS
Enjoy
... Wernhard