Problem importing Content with multiple images/files in it
Permalink
Hello everyone,
I created a XML File with "Generate Install Data Package" and I try to import it into a fresh installed c5 page.
Everything works fine except one little thing: The import of images/files.
For one block I serialize the data, leaving more then one image/file in the same line. It looks like this:
a:5:{i:0;s:1:"{ccm:export:image:client3.jpg}";i:1;s:2:"ccm:export:image:client2.jpg}";i:2;s:2:"ccm:export:image:client1.jpg}";i:3;s:2:"ccm:export:image:client5.jpg}";i:4;s:2:"{ccm:export:image:client2.jpg}";}
When c5 tries to render the images, it fails at the getValue() function in concrete/core/libraries/content/importer.php
Better said, it seems like the preg_match() collides with the given serialized string, it works if I put a new Line after every }. So it seems the multiple } in one Line is causing all of it.
Is there a way to change the preg_match() ->
'/\{ccm:export:page:(.*)\}|\{ccm:export:file:(.*)\}|\{ccm:export:image:(.*)\}|\{ccm:export:pagetype:(.*)\}/i'
so that it even works with multiple images in one line?
I can't put the new Line in it because afterwards I need the data in one line in the database or unserialize will not work.
EDIT:
it seems like the function returns only one fID and can't return multiple. So there is another problem if the one with preg_match gets fixed...
Thanks in advance,
Dosde
I created a XML File with "Generate Install Data Package" and I try to import it into a fresh installed c5 page.
Everything works fine except one little thing: The import of images/files.
For one block I serialize the data, leaving more then one image/file in the same line. It looks like this:
a:5:{i:0;s:1:"{ccm:export:image:client3.jpg}";i:1;s:2:"ccm:export:image:client2.jpg}";i:2;s:2:"ccm:export:image:client1.jpg}";i:3;s:2:"ccm:export:image:client5.jpg}";i:4;s:2:"{ccm:export:image:client2.jpg}";}
When c5 tries to render the images, it fails at the getValue() function in concrete/core/libraries/content/importer.php
Better said, it seems like the preg_match() collides with the given serialized string, it works if I put a new Line after every }. So it seems the multiple } in one Line is causing all of it.
Is there a way to change the preg_match() ->
'/\{ccm:export:page:(.*)\}|\{ccm:export:file:(.*)\}|\{ccm:export:image:(.*)\}|\{ccm:export:pagetype:(.*)\}/i'
so that it even works with multiple images in one line?
I can't put the new Line in it because afterwards I need the data in one line in the database or unserialize will not work.
EDIT:
it seems like the function returns only one fID and can't return multiple. So there is another problem if the one with preg_match gets fixed...
Thanks in advance,
Dosde