11 years ago
8
Topic

dear friends on seblod community

first i would like to say that seblod is great. We can do anything that we want with it

and then i was using the core 42 and had some hard time figuring out what it was.

i was finally able to solve my problem and since there is not that much document on the subject i decided to share with everyone here so you can use this method too:

let’s say that we wanted to use some field value to create an “if else” statement or  process that information  a bit

first we create a core42 field and add this code to the “prepare store” section:


$input = JFactory::getApplication()->input;


//this returns the value of your filed:

$v = $input->get('name_of_your_field', '', 'post');

if (($v > 84) && ($v <= 100))

 {

 $r = "A";

 }

elseif (($v > 69) && ($v <= 84))

 {.......

//the rest of your process goes here

///and then

$value = $r;

// $r is the result that you want to store


again,seblod is a very good tool for creating webapps


respects


Get a VIP membership
10 years ago
0
Level 1
thanks for your share.
10 years ago
0
Level 1
Hi

We didn't spend time on this field 42 but I don't see the difference between field 42 and the code fields (before render, before or after store). May be you can explain here?
thanks

cyril

10 years ago
5
Level 1
Hi all,
both are for run some php code. The differences come from events.

Field 42 allow you to add code on events:
  • PrepareContent
  • PrepareStore

Best regards.
Lionel
10 years ago
4
Level 2
Ok thanks Lionel, that's clear now!
cyril
10 years ago
3
Level 4
Hi

the code pack may be one of the most important addition to seblod for me. With it we almost do whatever we want.

for your example you can use a before storage php code that adds +1 to an existing field in your content.
just read the current value and in the $config['storages'] field locate the field and increase its value.

you just can't do $fields['myfield']->value = $fields['myfield']->value+ 1;
since it won't have any effect as long as you don't store the result
so you need to do:

$fields['myfield']->value = $fields['myfield']->value+ 1;
$config['storages']['#__cck_store_form_nameofmycontenttype']['myfield'] = $fields['myfield']->value;

cyril

10 years ago
2
Level 6
please do!
we need to help each others here. At Pulsar we have been investing on seblod for two years now and keep finding it is an excellent product but with a lack of communication. We work with Drupal too and I can tell you there are many cases where Joomla+seblod is way easier, faster and more efficient.

cyril
10 years ago
1
Level 8
From k2 homepage i see the latest release is from July 8th 2013. Seblod is at the moment very actively developed.
10 years ago
0
Level 9
Yes very active developing....but none support. Seblod is great, but in many kinds not useful, because it's no good documentation. And in the official forums the most answers are not solved by the team. Very very sad....
Get a Book for SEBLOD