ProcessWire - Tipps & Tricks

Aus Wikizone
Wechseln zu: Navigation, Suche

HTML[Bearbeiten]

Tags on the fly umwandeln mit ready.php[Bearbeiten]

Die Datei

site/ready.php 

kann genutzt werden um die Ausgabe von Feldern noch einmal zu bearbeiten. Hier werden alle

Tags durch eine Klasse ergänzt.

<?php
if($page->template->hasField('name-of-your-ckeditor-field')){
  $string = $page->name-of-your-ckeditor-field;
   //create string replace for blockquote
  $string = str_replace('<blockquote>', '<blockquote class="blockquote">', $string);
  //here you can add further manipulations....
  //..............
  //finally set the value back with manipulations
  $page->name-of-your-ckeditor-field = $string;
}