Wiz CMS Tutorials

Editing Multiple Texts from One Editor Instance

Overview

Wiz is designed to allow you to pick individual portions of the page to edit in their own editor. That is what makes it unique and extremely simple & useful. However, sometimes you've got a lot of similar bits of text you want to edit and it would just save a lot of implementation time if you could set up one instance of the editor to edit all of them.

Well...now you can. Wiz now has a feature to allow the simple text or rich text editor to be given a list of text files to edit, and allows you to choose which one it is to edit based on a URL variable named edit.

How To Do It

In typical usage of the text editors you would tell the instance which text file it is to be editing via its $fileToEdit variable. Now, if you go a bit further down the file you'll find a $fileEditList variable. In this variable you can give an array of keys and values that determine what text files the editor is to edit when given a URL with a certan variable attached. For example:

$fileEditList = array(
'first' => 'one.txt',
'second' => 'two.txt',
'third' => 'three.txt'
);

Now if your editing instance was at mysite.com/myeditor.php you could tack on a URL variable of one of the array keys to tell it what file to be editing. Example: mysite.com/myeditor.php?edit=first would edit one.txt, and mysite.com/myeditor.php?edit=third would edit three.txt.

The Rest...

The rest of the setup is basically the same. You'd still have a text file to hold the data for each bit of editable text, and you'd still draw that data into the website itself with the standard PHP snippet for doing so. The main difference is that now the most time consuming part (setting up the editor) can be done with 1 file for many pieces of text.

Notes

1) If no URL variable is given in the URL when viewing the editor, or if one is given that doesn't match one of the keys in the $fileEditList array, the editor will just use the original $fileToEdit variable and act like an otherwise normal instance of the editor.

2) The name of the URL variable doesn't have to be edit. Notice that right below the $fileEditList variable there is a $urlVarName variable where you can set it to whatever you want. For example, change it to text and the URL for editing would look something like mysite.com/myeditor.php?text=third.

3) This feature is part of v1.0.1 onward. There were only something like 4 buyers of v1.0.0 before the update to 1.0.1 happened...but if you don't see the $fileEditList variable you may be one of those 4 and need to download the latest version of Wiz to get this feature.

Tutorial Menu