103 Posts
Osep45
7 years ago
Topic

Hi,

I have created a song content type. 

In the database, I want to create a line in another table (independant of Seblod : "mysong") every time I create/modify a song.

A bit like this example (https://www.seblod.com/resources/tutorials/create-content-dynamiclly-using-code), but with two differences :

- my table isn't a seblod form table

- when I modify an article, it should also modify the table.

How can I do that please ? 

Thanks in advance,

Osep45

Get a Book for SEBLOD
4229 Posts
Kadministrator
7 years ago
0
Level 1

You can use code plugins  e.g. afterStore and do what you need to do there. I suggest you look up Joomla database classes on how to store or update a value in Joomla.

103 Posts
Osep45
7 years ago
0
Level 1

Hi,

Best wishes for 2017 !

Thank you Klas for your answer. I haven't manage to do what you suggest.


Finaly, I overcame my difficulties as follows :

1- For getting the same id as the content_table, I added "Stage" in my form, and an "id" field in the 1st stage.

Storage :

Format : "Standard" / "Free" / "id"

Paramètre : "My_external_table"

and in the panel 2 :

Dymamic value "url : Variable"

Configuration : "id"

2- In the 2nd stage, for each information to fill in the external_table, I have created a field with a different storage :

Format : "Standard" / "Free" / "my_colunn_of_my_external_table"

Paramètre : "My_external_table"


3- As I wanted to duplicate dynamiccly the value of an existing field, I have also created a second field "Before storage" with this code :

(example : the title)

$fields['chants_titre_dans_phoca']->value = $fields['art_title']->value;
$name = $fields['chants_titre_dans_phoca']->storage_field;
$table = $fields['chants_titre_dans_phoca']->storage_table;
$config['storages'][$table][$name] = $fields['art_title']->value;

I hope that it will help.

Don't hesitate to suggest a best solution !

osep45

Get a VIP membership