Processwire - Themes / Templates: Unterschied zwischen den Versionen

Aus Wikizone
Wechseln zu: Navigation, Suche
Zeile 19: Zeile 19:
 
</pre>
 
</pre>
  
 +
== Rendering Strategien ==
 +
=== Beispiele ===
 +
http://blog.mauriziobonani.com/processwire-basic-website-workflow-part-2/
 +
=== Render Funktionen ===
 +
https://processwire.com/blog/posts/processwire-3.0.7-expands-field-rendering-page-path-history-and-more/#theres-also-page-gt-rendervalue
 +
 +
<syntaxhighlight lang="php">
 +
// New Functions in 3.x
 +
render()
 +
renderValue()
 +
 +
// Functions for 2.x or for easy snippet inclusion (also possible with render
 +
wireRenderFile() // mostly used for delayed output
 +
wireIncludeFile() // for direct output
 +
// i.e.
 +
// returns the output of snippets/contactform.php
 +
// the second argument is optional and will be passed to
 +
// the called file as multiple variables with the name of the key
 +
// also all api varables are available by default
 +
 +
wireRenderFile("snippets/contactform", array("stuff" => $something ));
 +
</syntaxhighlight>
 
=== Delayed Output and Advanced Templates ===
 
=== Delayed Output and Advanced Templates ===
 
Über prependTemplateFile und appendTemplateFile verarbeitet man die Templates wenn alle Inhalte zusammengesetzt sind.
 
Über prependTemplateFile und appendTemplateFile verarbeitet man die Templates wenn alle Inhalte zusammengesetzt sind.
Zeile 58: Zeile 80:
  
 
=== 3.x Strategie ===
 
=== 3.x Strategie ===
 
  
 
== Syntax und Konventionen ==
 
== Syntax und Konventionen ==

Version vom 24. April 2017, 12:46 Uhr

Links

Siehe auch

Theme Strategien

Basic Theme

templates/
  _func.inc (wenn benötigt)
  home.php
  basic_page.php
templates/partials
  foot.inc
  head.inc

Rendering Strategien

Beispiele

http://blog.mauriziobonani.com/processwire-basic-website-workflow-part-2/

Render Funktionen

https://processwire.com/blog/posts/processwire-3.0.7-expands-field-rendering-page-path-history-and-more/#theres-also-page-gt-rendervalue

// New Functions in 3.x 
render()
renderValue()

// Functions for 2.x or for easy snippet inclusion (also possible with render
wireRenderFile() // mostly used for delayed output
wireIncludeFile() // for direct output
// i.e.
// returns the output of snippets/contactform.php
// the second argument is optional and will be passed to 
// the called file as multiple variables with the name of the key
// also all api varables are available by default

wireRenderFile("snippets/contactform", array("stuff" => $something ));

Delayed Output and Advanced Templates

Über prependTemplateFile und appendTemplateFile verarbeitet man die Templates wenn alle Inhalte zusammengesetzt sind.

Ordnerstruktur

templates/
  _func.inc
  _init.inc
  _main.inc
templates/partials
  foot.inc
  head.inc

config.php

<?php
...
$config->debug = false;
$config->sessionFingerprint = true;
$config->prependTemplateFile = '_init.php';
$config->appendTemplateFile = '_main.php';
$config->imageSizerOptions = array(
	'upscaling' => true, // upscale if necessary to reach target size?
	'cropping' => true, // crop if necessary to reach target size?
	'autoRotation' => true, // automatically correct orientation?
	'sharpening' => 'soft', // sharpening: none | soft | medium | strong
	'quality' => 90, // quality: 1-100 where higher is better but bigger
	);


AJAX Driven Theme

config.php

// if ajax request set
$ajax = $input->post->ajax;


3.x Strategie

Syntax und Konventionen

Module

Processwire - Writing Modules

Recommended Modules

FormBuilder (kostenpflichtig) - FormBuilder
ProFields (kostenpflichtig) - https://processwire.com/talk/store/product/10-profields/
Hanna Code (wie bei Wordpress) 	- TextformatterHannaCode
Map Marker (google Maps) - FieldtypeMapMarker
Simple Navigation - MarkupSimpleNavigation
AIOM - All In One Minify - AllInOneMinify

Grundausstattung

Felder

  • content_main (left/right/aside/sidebar)
  • link_to_child (checkbox to link to subpage)
  • summary