Deprecated: Smarty::_getTemplateId(): Implicitly marking parameter $template as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/Smarty.class.php on line 1048

Deprecated: Smarty_Internal_Data::getTemplateVars(): Implicitly marking parameter $_ptr as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/sysplugins/smarty_internal_data.php on line 193

Deprecated: Smarty_Internal_Data::_mergeVars(): Implicitly marking parameter $data as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/sysplugins/smarty_internal_data.php on line 203

Deprecated: Smarty_Internal_Template::__construct(): Implicitly marking parameter $_parent as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/sysplugins/smarty_internal_template.php on line 149

Deprecated: Smarty_Resource::source(): Implicitly marking parameter $_template as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/sysplugins/smarty_resource.php on line 175

Deprecated: Smarty_Resource::source(): Implicitly marking parameter $smarty as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/sysplugins/smarty_resource.php on line 175

Deprecated: Smarty_Resource::populate(): Implicitly marking parameter $_template as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/sysplugins/smarty_resource.php on line 199

Deprecated: Smarty_Template_Source::load(): Implicitly marking parameter $_template as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/sysplugins/smarty_template_source.php on line 158

Deprecated: Smarty_Template_Source::load(): Implicitly marking parameter $smarty as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/sysplugins/smarty_template_source.php on line 158

Deprecated: Smarty_Internal_Resource_File::populate(): Implicitly marking parameter $_template as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/sysplugins/smarty_internal_resource_file.php on line 28

Deprecated: Smarty_Internal_Resource_File::buildFilepath(): Implicitly marking parameter $_template as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/sysplugins/smarty_internal_resource_file.php on line 101

Deprecated: Parsedown::blockList(): Implicitly marking parameter $CurrentBlock as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/parsedown/Parsedown.php on line 574

Deprecated: Parsedown::blockSetextHeader(): Implicitly marking parameter $Block as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/parsedown/Parsedown.php on line 811

Deprecated: Parsedown::blockTable(): Implicitly marking parameter $Block as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/parsedown/Parsedown.php on line 897
NiftyCMS - Themes Templating
Logo

NiftyCMS - Themes Templating


NiftyCMS nutzt die kraftvolle Template-Engine Smarty und ermöglicht dadurch eine einfache Erstellung neuer moderner Templates.

Download NiftyCMS
home » niftycms templating »

Deprecated: Smarty_Internal_Method_GetTemplateVars::getTemplateVars(): Implicitly marking parameter $_ptr as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/sysplugins/smarty_internal_method_gettemplatevars.php on line 34

Deprecated: Smarty_Internal_Method_GetTemplateVars::_getVariable(): Implicitly marking parameter $_ptr as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/sysplugins/smarty_internal_method_gettemplatevars.php on line 87

Inhalt

Einfaches Templating mit Smarty

Templates sind HTML-Vorlagen die so genannte Token bzw. Template-Variablen nutzen, die von der Template-Engine zur Laufzeit mit realem Content gefüllt werden. NiftyCMS hat die leistungsstarke Template-Engine Smarty implementiert und ist damit dem dortigen Markup unterworfen.

Smarty Markup

Die Markup-Vorschrift für die Erstellung neuer und interessanter Layouts für Ihre Webseite, ist schematisch sehr einfach gehalten und sieht etwa so aus:

<html>
    <head>
        ...
    </head>
    <body>
        <h1> {$title}       </h1>
        <p>  {$description} </p>
        <p>  {$content}     </p>
        <hr>
        {$date} - {$author}
    </body>
</html>

Grundsätzliche Markup-Syntax der Smarty Template-Engine

Inhalte die aus dem Beitrag in das Template gestellt werden sollen, müssen folglich mit {$...} formatiert werden.

Template-Dateien

Die eigentlichen HTML-Vorlagen (Templates) sind nichts anderes, als ganz normale HTML-Dokumente, bei denen alle Textstellen mit den oben genannten Tokens ersetzt werden. Die Template-Engine Smarty ersetzt alle diese Stellen zur Laufzeit mit den echten Beitragsinhalten.

Template-Dateien werden üblicherweise mit der Dateiextension *.tpl gespeichert. Die Extension tpl ist zwar typisch für Smarty, jedoch nicht zwingend, denn die Extensionen *.txt, *.html oder *.php funktionieren genau so gut. Nutzen Sie Editoren, wie beispielsweise Visual Code, dann kann dieser eine entsprechend farbliche Syntaxhervorhebung im Code aktivieren - dies ist jedoch von der gewählten Extension abhängig, daher ist es sinnvoll der Empfehlung zu folgen.

Smarty: Doku


Oliver Lohse - 2024-11-26

Weitere Themen


NiftyCMS - assoziative Arrays

NiftyCMS nutzt in einigen Templates assoziative Arrays für die Übergabe der Daten an das Template.


Deprecated: Smarty_Template_Config::load(): Implicitly marking parameter $_template as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/sysplugins/smarty_template_config.php on line 73

Deprecated: Smarty_Template_Config::load(): Implicitly marking parameter $smarty as nullable is deprecated, the explicit nullable type must be used instead in /homepages/41/d166645450/htdocs/NiftyCMS/NiftyCMS/core/smarty-4-3-4/libs/sysplugins/smarty_template_config.php on line 73
Affiliate

PHP8 und MySQL - Dynamische Webseiten mit PHP und MySQL programmieren: Alles, was Sie dafür wissen müssen, steht in diesem Buch. Profitieren Sie von einer praxisorientierten Einführung und lernen Sie alle neuen Sprachfeatures von PHP 8 kennen. Die Autoren Christian Wenz und Tobias Hauser sind erfahrene PHP-Programmierer und Datenbankspezialisten

Die Seite ist Mitglied Amazon.Partnernet und kann mit Affiliate-Links den Betrieb etwas unterstützen, für Sie ist das natürlich vollkommen kostenlos.

Seobility Score für niftycms.de

Impressum


NiftyCMS verfolgt den Zweck, ein ganz einfaches Content Management System zu entwickeln, welches nur sehr geringe Abhängigkeiten zu Drittsystemen besitzt.

Datenschutz


NiftyCMS nuntzt keinerlei Tracking- oder andere Speichermechanismen, die Rückschlüsse auf das Leserverhalten oder die individuelle IP-Adresse zulassen.

Kontakt


Sie können mit mir unter Kontakt@Oliver-Lohse.de Rücksprachen halten oder Anfragen senden. Ein aussagekräftiger Betreff hilft Mails deutlich von SPAM zu separieren.

in cooperation with: CMSWorkbench - GIMP-Handbuch - Oliver-Lohse - Smarty