Database Reference
In-Depth Information
Displaying parts of a text
The
text/plain: substr
transformation is available for displaying only a portion
of the text. Here are the options:
•
First: where to start in the text (default: 0)
•
Second: how many characters (default: all the remaining text)
•
Third: what to display as a suffix to show that truncation has occurred; the
default is to display ellipses (...)
Remember that
$cfg['LimitChars']
is doing a character truncation for every
non-numeric field. Hence,
text/plain: substr
is a mechanism for fine-tuning this
field-by-field.
Download link
Let's say we want to store a small audio comment about each book inside MySQL.
We add a new field to the
book
table, with the name
audio_contents
, and type
MEDIUMBLOB
. We set its
MIME type
to
application/octetstream
and choose the
application/octetstream: download
transformation. In the
Transformation
options
,
we insert
'comment.wav'
.
This MIME type and extension will inform our browser about the incoming data,
and the browser should open the appropriate player. To insert a comment, we
first record it in a
.wav
format, and then upload the contents of the file into the
audio_contents
ield for one of the topics. When browsing our table, we can see a
link
comment.wav
for our audio comment.
Chapter 17 describes the BLOB streaming technique, which is more
appropriate for bigger chunks of data (for example, using phpMyAdmin
to watch a movie stored in MySQL!).
Search WWH ::
Custom Search