Re: Update/copy a blob-field
Quote:
I need to update a blob-field via phpmyadmin.
I'm no expert but I don't think you can unless you enter the data in serialized form, which requires php processing.
What is in the blob is not data as such, but a representation of the data (so not easily manipulated - ie: you can't search or query it in MySQL)
Quote:
I have read pages on unserializing, but I don't understand it!
Contao enters data into certain fields as a serialized array. (eg: the member groups and, as you point out, the publicFields).
To see this data in "real" form requires unserializing (a php function) to get an array , and then looping the array to get its parts.
This probably won't help you, but for me to print the serialized array "openhome_dates" onto an html page via the variable "calendarshow" , I need to do this:
Code:
$openhomes = deserialize($objHousesella->openhome_dates);
if(is_array($openhomes) && count($openhomes) > 0)
{
$calendarshow .= '<div class="openhome_dates">';
foreach($openhomes as $openhome)
{
$calendarshow .= '<div class="openhome_date">
<span class="listinglabel openhomelabel">Start: </span><span class="listingtext openhomestart">'.$openhome[0].'</span>
<span class="listinglabel openhomelabel">End: </span><span class="listingtext openhomeend">'.$openhome[1].'</span>
</div>';
}
$calendarshow .= '</div>';
}
"openhome_dates" consists of an undetermined number of rows of two dates, which the foreach loop outputs each loop as $openhome[0] and $openhome[1].
Likewise, inserting the data into MySql requires it to be made into an array, and then serialized before insertion.
Contao, or a custom widget, generally handles this.
I think deserializing (which is a Contao function, not a php one) does both at once.
Quote:
I'm sorry for my newbie question!
It ain't no newbie question, its a damned complicated process. There is talk of doing away with this in a future Contao version in favour of readable csv values.
Re: Update/copy a blob-field
Thank you for you answer Ramjet!
So, there is no way to copy a Blob then, or does anyone know a way (and have the time to tell me :)) how to deserialize and serialize the data and then how to put in the data into the database?
Maybe it's better to make a template which gives all new members the same public data, so that it's already set somehow. Someone who knows how to do this?
/Annika
Re: Update/copy a blob-field
Quote:
Originally Posted by AnnikaW
Thank you for you answer Ramjet!
So, there is no way to copy a Blob then, or does anyone know a way (and have the time to tell me :)) how to deserialize and serialize the data and then how to put in the data into the database?
Maybe it's better to make a template which gives all new members the same public data, so that it's already set somehow. Someone who knows how to do this?
try adding to "system/config/dcaconfig.php" the following entry:
Code:
$GLOBALS['TL_DCA']['tl_member']['fields']['publicFields']['default'] = array('firstname', 'lastname', 'mobile');
However I do not know from which extension comes the "publicFields" field in tl_member