Bienvenido, Invitado
Recordarme

TEMA:

CB Content Prepare : How to add calculated fields 6 meses 1 semana antes #257323

  • Autor del tema
  • hverdel
  • Fuera de línea
  • Junior Breezer
  • Junior Breezer
  • Mensajes: 41
  • Gracias recibidas: 0
Is there a way to add new fields, for display purposes only?

I have tried in the Content Prepare tab of a view:
$statii = array("1" => "Ingediend", "2" => "Bezig", "3" => "Goedgekeurd", "4" => "Afgekeurd", "5" => "Vervallen");
$items["StatusTekst"] = array("label" => "Status", "value" => $statii[$items["Status"]["value"]]);

However having {StatusTekst:value} in the template results in displaying literally: "{StatusTekst:value}".

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

CB Content Prepare : How to add calculated fields 6 meses 1 semana antes #257329

  • Avatar de tihana.krivic
  • tihana.krivic
  • Fuera de línea
  • Moderator
  • Moderator
  • Mensajes: 7381
  • Karma: 3
  • Gracias recibidas: 529
Hi,

is this content builder only or integration with BF?

If this is only content builder you can add new field, and enable "Include in list" for this field, but not enable "Editable". After that this field will be for purpose only

Regards,
Tihana

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

CB Content Prepare : How to add calculated fields 6 meses 1 semana antes #257334

  • Autor del tema
  • hverdel
  • Fuera de línea
  • Junior Breezer
  • Junior Breezer
  • Mensajes: 41
  • Gracias recibidas: 0
This is CB only.

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

CB Content Prepare : How to add calculated fields 6 meses 1 semana antes #257346

  • Avatar de tihana.krivic
  • tihana.krivic
  • Fuera de línea
  • Moderator
  • Moderator
  • Mensajes: 7381
  • Karma: 3
  • Gracias recibidas: 529
Hi,

If this is only content builder you can add new field, and enable "Include in list" for this field, but not enable "Editable". After that this field will be for purpose only

Did you try this?

Regards,
Tihana

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

CB Content Prepare : How to add calculated fields - 99% solved 6 meses 1 semana antes #257408

  • Autor del tema
  • hverdel
  • Fuera de línea
  • Junior Breezer
  • Junior Breezer
  • Mensajes: 41
  • Gracias recibidas: 0
I can only add fields to data sources, not to views.

I have the situation that a composition of fields (for display) depends on some other field value.
This is not a data issue, just a display (view) issue. So i don't want this persisting in my database.

I found a way that's almost what i want. I'll illustrate by means of an example.

My data source has a field "Color", which is a group field. Values are:
Red;1
Green;2
Blue;3
In the "Content prepare" section i have added:
switch ($items["Color"]["value"])
{ case 1: $color = 'Red'; break;
  case 2: $color = 'Green'; break;
  case 3: $color = 'Blue';
}

$coloritem = array("label"=>"ColorTekst", "id"=>"474001", "value"=>$color);
$items["ColorText"] = $coloritem;
(It needs to have an ID, to not be skipped entirely.

Now i can use "{ColorText:value}" in my template without actually having a colortext field, which was the initial goal.

Why almost?
In the contentbuiler.php code the "Content prepare" is processed at a point where the {hide} tags no longer work. Maybe that's something Crosstec can fix some time.
A good alternative is to test before adding the field, but that would still not enable multiple {hide-if-matches} with different values to test. I don't think that would bother many.

Hope this helps.

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Última Edición: Post by hverdel. Razón: Solved (almost)

CB Content Prepare : How to add calculated fields - 99% solved 6 meses 1 semana antes #257422

  • Avatar de tihana.krivic
  • tihana.krivic
  • Fuera de línea
  • Moderator
  • Moderator
  • Mensajes: 7381
  • Karma: 3
  • Gracias recibidas: 529
Hi,

I like it :)

In the contentbuiler.php code the "Content prepare" is processed at a point where the {hide} tags no longer work. Maybe that's something Crosstec can fix some time.
A good alternative is to test before adding the field, but that would still not enable multiple {hide-if-matches} with different values to test. I don't think that would bother many.

Yes, I agree with you, let me research this a little bit :)

Regards,
Tihana

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

  • Página:
  • 1
  • 2
Tiempo de carga de la página: 0.123 segundos