Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Coding Releases
You last visited: Today at 15:54

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] ETMuS - Simple template system

Discussion on [Release] ETMuS - Simple template system within the Coding Releases forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jan 2010
Posts: 22
Received Thanks: 35
Arrow [Release] ETMuS - Simple template system

+----------+
| English |
+----------+
Hi all,

I am proud to release my third work now: ETMuS - Extendable Template Markup Script. I will also publish some plugins for this release soon. Those will include a plugin for MySQL and MSSQL database connections. I started this project quite a while ago and was always extending it and adding some features.

I hope that this script helps someone out there to create complex sites with a low cost of time building up the base for it. It was developed to have very simple template script which keeps the HTML (Design) parts away from the PHP (Coding) ones.

Requirements:
  • bcompiler
  • PHP >= 5.3
You can find the files and some examples at my filespace here:
The documentation can be found here:

How to use?
First you have to get the singleton instance of the ETMuS class by using:
PHP Code:
$instance = +OutstandDesig+ETMuS+ETMuS::getSingleton(); 
Note: + should be a backslash (\) but unfortunatly it is cut off here

Now you can use the following options:
  • User defined variables
    by writing
    PHP Code:
    $instance->UserDefined "42"
    you can use
    HTML Code:
    <<UserDefined>>
    in your design files as variable and it will be parsed to 42
  • Predefined variables
    by writing
    PHP Code:
    $instance->Pagetitle "1337"
    you can use the predefined
    HTML Code:
    <<PAGETITLE>>
    to set the page title. A full list with all predefined variables can be found in the documentation.
  • Navigation
    You can add a new Navigationpoint by using
    PHP Code:
    $instance->NavigationAddLink($menuname, array("name" => linkname"url" => linkurl[, "active" => false])[, $parentmenuname]); 
    In your designfiles you can use the navigation by writing
    HTML Code:
    <<NAV:MENUNAME>>
    This will include the following files from your designfolder in the following order:
    navigation_start_MENUNAME.html
    navigation_substart_MENUNAME.html
    navigation_1_MENUNAME_off.html/on.html for each navigationlink
    navigation_2_MENUNAME_off.html/on.html for each sublink
    navigation_subend_MENUNAME.html
    navigation_end_MENUNAME.html
    If one or more files are not available they will be skipped and a notice will be thrown.
  • Tables
    You can use tables if you have content that returns a few times for example a <table> with 5 rows and 2 columns, you can write a foreach or equal which contains the following line:
    PHP Code:
    $instance->TableData_TestTable = array("key1" => "value1""key2" => "value2"); 
    This line will add a row to the TestTable. Each row will be the content of the TestTable.html (in the design folder). The vars will be replaced by the value of the specified key (key1, key2). These keys need to be written as
    HTML Code:
    [<KEY1>] or [<KEY2>]
    within the table template to avoid conflicts with same-named "global" variables.
    A table is marked by using
    HTML Code:
    <<INCLUDE:TESTTABLE:TABLE>>
    in your design file
  • Includes
    Files from your Designfolder can be included by using
    HTML Code:
    <<INCLUDE:INCFILE>>
    in your design files. This tag will include the incfile.html file. The content will be parsed for further tags.
  • Privileges
    If
    PHP Code:
    $instance->User != NULL 
    , the content between
    HTML Code:
    <<PRIVILEGE:LOGGEDIN>> and <</PRIVILEGE:LOGGEDIN>>
    will be displayed.
    You can negate this expression by using
    HTML Code:
    <<!PRIVILEGE:LOGGEDIN>> and <</PRIVILEGE:LOGGEDIN>>
    A more complex Privileges plugin is already in development.
A full list of the currently supported features can be found in the download files. The folder structure needs to be used as is. Each example is a single page with an identifiying name.

You can ask me here or in skype if you have any questions. I can help you also in building up a new webpage if you have any problems.

+-----------+
| Deutsch |
+-----------+
Hallo zusammen,

ich freue mich euch heute hier meine dritte Veröffentlichung zu präsentieren: ETMuS - Extendable Template Markup Script. Ich werde in naher Zukunft weitere Erweiterungen für das Skript zur Verfügung stellen, darunter auch eine Erweiterung für MySQL und MSSQL Verbindungen. Ich habe mit diesem Projekt schon einer halben Ewigkeit angefangen und seit dem kontinuierlich ausgebaut und verbessert.

Ich hoffe, dass dieses Skript einigen dabei hilft mit einfachen Mitteln größere Projekte in sehr kurzer Zeit zu verwirklichen. Desweiteren ist das Skript speziell darauf ausgelegt, das Design vom PHP-Quelltext zu trennen um neue Designs blitzschnell anzupassen und einzupflegen genauso wie neue Features.

Vorraussetzungen:
  • bcompiler
  • PHP >= 5.3
Die benötigten Dateien und Ordner sowie einige Beispiele finden sich auf hier:
Die Dokumentation findet sich in Englisch hier:

Wie funktionierts?
Zu aller erst sollte man sicherstellen, dass man eine Instanz erhält. Dazu folgende Funktion abrufen:
PHP Code:
$instance = +OutstandDesig+ETMuS+ETMuS::getSingleton(); 
Beachtet: Das + sollte eig. ein \ darstellen. Leider werden die im PHP-Code-Tag entfernt .

Nachdem die Instanz abgerufen wurden, kann man nun folgendes damit machen:
  • Benutzerdefinierte Variablen
    durch
    PHP Code:
    $instance->UserDefined "42"
    kann man in den Designdateien folgende Konstrukt verwenden:
    HTML Code:
    <<UserDefined>>
    Dies wird nach dem Parsen zu 42.
  • Vordefinierte Variablen
    Vordefinierte Variablen müssen nicht explizit gesetzt werden, da sie bereits einen Wert besitzen.
    PHP Code:
    $instance->Pagetitle "1337"
    Setzt den Seitentitel auf 1337, wenn man folgendes Tag in den Designdateien unterbringt:
    HTML Code:
    <<PAGETITLE>>
    Eine ausführliche Dokumentation aller Vordefinierten Variablen findet sich in der Doku (siehe oben)
  • Navigation
    Ein Navigationspunkt für ein Menü kann durch folgende Funktion hinzugefügt werden:
    PHP Code:
    $instance->NavigationAddLink($menuname, array("name" => linkname"url" => linkurl[, "active" => false])[, $parentmenuname]); 
    Nun kann ein oder mehrere zusammengehörige Links durch das folgende Tag plaziert werden:
    HTML Code:
    <<NAV:MENUNAME>>
    Dadurch werden nun folgende Dateien eingebunden:
    navigation_start_MENUNAME.html
    navigation_substart_MENUNAME.html
    navigation_1_MENUNAME_off.html/on.html für jeden Navigationslink innerhalb eines Blocks
    navigation_2_MENUNAME_off.html/on.html für jeden Sub-Navigationslink innerhalb eines Blocks
    navigation_subend_MENUNAME.html
    navigation_end_MENUNAME.html
    Falls eine oder mehrere Dateien nicht vorhanden sind (oder nicht benötigt werden), so werden diese übersprungen und eine Notice wird ausgegeben.
  • Tabellen
    Tabellen kommen dann zum Einsatz, wenn man einen gewissen Inhalt mehrfach wiederholen muss und sich nur einzelne Positionen ändern z.b. eine Tabelle oder auch Warenliste mit 10 Gegenständen (mit individueller Beschreibung, Preis etc.). In solchen Fällen werden die Daten i.d.R. per PHP aus einer DB/Datei/Array geladen. Durch eine Foreach/While/For wird dann der folgende Befehl für jede Zeile abgesetzt:
    PHP Code:
    $instance->TableData_TestTable = array("key1" => "value1""key2" => "value2"); 
    Jede Zuweisung zu TableData_TestTable erzeugt eine neue Zeile, wobei als Template die Datei TestTable.html (aus dem Designordner) genommen wird.
    Um keine Verwechslung mit "globalen" Variablen zu bekommen, greift man auf Table Variablen mit
    HTML Code:
    [<KEY1>] or [<KEY2>]
    zu, wobei als Variablenname der Schlüssel des Array genommen wird.
    Eine Tablle wird in der Designdatei gekennzeichnet durch
    HTML Code:
    <<INCLUDE:TESTTABLE:TABLE>>
  • Includes
    Um weitere Dateien (z.b. Seitenübergreifender Inhalt) einzubinden wird folgendes Tag genutzt:
    HTML Code:
    <<INCLUDE:INCFILE>>
    Dieses Beispiel bindet die incfile.html Datei ein. Der Inhalt wird wiederrum erneut geparst auf weitere Tags.
  • Zugriffsrechte
    Wenn
    PHP Code:
    $instance->User != NULL 
    , so wird der Inhalt zwischen
    HTML Code:
    <<PRIVILEGE:LOGGEDIN>> und <</PRIVILEGE:LOGGEDIN>>
    angezeigt.
    Durch die Negierung mittels
    HTML Code:
    <<!PRIVILEGE:LOGGEDIN>> und <</PRIVILEGE:LOGGEDIN>>
    kann Inhalt vor eingeloggten Benutzern verborgen werden.
    Ein Plugin für speziellen Nutzergruppen Zugriff ist zur Zeit in der Endphase der Entwicklung und wird sicherlich auch bald veröffentlicht.
Eine komplette liste aller aktuellen Features können in den Herunterladbaren Dateien gefunden werden. Die Ordnerstruktur muss genauso übernommen werden. Die Beispiele sind jeweils auf verschiedene Seiten aufgeteilt und eindeutig benannt.

Falls ihr Fragen habt, bin ich natürlich per Skype oder hier direkt verfügbar. Ich kann euch natürlich bei Problemen mit der Erstellung eurer eigenen Webseite helfen.

M2Commander
M2Commander is offline  
Thanks
3 Users
Old 05/03/2012, 19:55   #2
 
qickly's Avatar
 
elite*gold: 0
Join Date: Apr 2011
Posts: 351
Received Thanks: 57
Echt gute Arbeit, ein thanks hast du dir verdient.
qickly is offline  
Old 05/05/2012, 19:59   #3
 
elite*gold: 26
The Black Market: 288/1/0
Join Date: Dec 2010
Posts: 4,343
Received Thanks: 2,395
Übersichtlich und schön strukturiert...
Thanks wert
hero9910 is offline  
Reply

Tags
template html php script


Similar Threads Similar Threads
[Release] SRO Template³
06/29/2012 - SRO Private Server - 6 Replies
Here is another Silkroad template you can use for your webpage. This one is a very smooth one =) I won't give you everything on a golden plate, so just keep on working on it :P You need to add the strings for DB connection etc. for your Servstats, Ranking,.... If you want a fully working template, ask some1 else :P I don't give this out, if you are lazy, you don't reach that much like others (Or just download a template everybody got for his pserver).. Well i hope i helps someone btw.. the...
[Release] SRO Template²
02/08/2012 - SRO Private Server - 7 Replies
Hey Community, Here is another Silkroad template you can use for your webpage. I won't give you everything on a golden plate, so just keep on working on it :P You need to add the strings for DB connection etc. for your Servstats, Ranking,.... ;) If you want a fully working template, ask some1 else :P I don't give this out, if you are lazy, you don't reach that much like others ;) (Or just download a template everybody got for his pserver).. Well i hope i helps someone ;) btw.. the header...
[Release {Template}] Metin2 Template by |R.o.x|
01/15/2011 - Metin2 PServer Guides & Strategies - 17 Replies
Hey Com, ich habe mal wieder ein Design gemacht und gecodet. Ich finde es ist eig ganz gut gelungen. Erstmal ein Screen : http://i51.tinypic.com/2zykh2x.jpg Jetzt zum eigentlichen : Um dieses Template zu benutzen loadet ihr euch erstmal die Datei aus dem Anhang. Dann entpackt ihr das Archiv mit WinRar oder sonstwas..
[PHP] Template System
01/11/2011 - Web Development - 3 Replies
moin moin, Damals als ich im Praktikum war habe ich mit einem anderen Praktikanten ein Templatesystem entwickelt - einfach gehalten! Ich habe vor ner zeit mal die 12 PHP sicherheits regeln gelesen: 2. Regel: In ein include() gehören keine REQUEST-Variablen. und nun wirfts mir die frage auf: kann ich des system ohne bedenken einsetzen? gibts da sicherheits lücken? hier der code:
Release Cameron's Simple System.mrs (F-Gunz)
06/07/2008 - GunZ - 0 Replies
The main things in it: 400 delay meds X10000 military and training daggers are swords. so they are capable of all kstyle. including insta, although hard. http://rapidshare.com/files/120519734/System.rar. html http://rapidshare.com/files/120519764/System.zip. html



All times are GMT +1. The time now is 15:55.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.