<?php
$sortie = "";
switch ($support):
case "AR_01":
$sortie = "carton plume";
break;
case "CA_01":
case "CL_01":
case "CL_02":
case "CL_03":
case "CL_04":
case "FB_01":
case "FB_01a":
case "FB_02":
case "FB_03":
case "FB_04":
case "FB_06":
case "FB_07":
case "MO_01":
case "MO_03":
case "RP_01":
case "NC_01":
case "PW_02":
$sortie = "papier";
break;
case 'toile':
$sortie = "toile coton";
break;
// BOIS !
case "B_01":
case "CP_10":
case "CP_15":
case "CPP_15":
case "MDF_10":
$sortie = "bois";
break;
default: // Programmation Défensive
$sortie = "????";
endswitch;
?>
<?= $sortie ?>
This is an old portion of code, in my very first steps in Kirby!
I already use a custom field to store one piece of information and from this information I can compute others.
In this case the basic information is a reference to the support of a painting. From this reference I deduce the information I need. If it is wood or paper for example. The use of snippet is thus direct and quickly set up.
If I want to go further and according to my understanding of Kirby the best is to use a plugin to centralize this information.
By the way, you’ve indicated the use of a function but where do you put it?