8 years ago
2
Topic

Hi,

    I have a form with some components and value listed into groupX. When I save the form I call a before store PHP. Into this PHP, I load each component and call by a SELECT each Component into table ...cck_store_form_[nom de la form]. In a column I have the list of groupx that are the sub-components. 

I need to decode this content to have the name and value of these sub-components. (eg:   <br />::comp_chimique::2::/comp_chimique::<br /><br />::cck_comp_chimique::composant_chimique_grpx::/cck_comp_chimique_ .....).

How I can decode this line? Is a function exist to perform it ?

Thank you in advance.

Get a VIP membership
8 years ago
1
Level 1

Hi ggl082,

you can use the " preg_match_all" PHP function with for regex something like:

$regex    =    '#::'.$fieldname.'\|(.*?)\|'.$groupname.'::(.*?)::/'.$fieldname.'\|(.*?)\|'.$groupname.'::#s';

Replace $fieldname and $groupname with the good one.

With that you will get an array with all data in the $matches variable.


Regards.

Lionel

8 years ago
0
Level 2

Hi Lionel,

   Thank you very much for your help. You are right, after some tests all work fine. In addition, in my case is more easy to use only first part of the pattern into a loop :

$regex = '#::'.$fieldname[].'\|(.*?)\|'.$groupname.'::(.*?)::#s';

Thank you

Regards,

Gérard

Get a Book for SEBLOD