FS_CATALOG ID oder UID
Author: th_biedermann
Publication Date: 6/2/2025 17:26
Hallo
Wir kommen ich bei einem FS-CATALOG an einen eindeutigen Schlüssel ran.
Am liebsten direkt auf dem xy_item
Ich brauche hier
<CMS_HEADER> </CMS_HEADER> <div class="image-text-block" $CMS_VALUE(if(#global.preview,editorId(),""))$> $CMS_IF(!st_copytext.isEmpty())$ <div class="atom-copytext $CMS_VALUE(if(set_hyphenate == "true","auto-hyphenate"))$" style="padding-bottom:50px;"> $CMS_VALUE(st_copytext)$ </div> $CMS_END_IF$ <div class="chart-container-canvas-$CMS_VALUE(st_diagram_typ, default: "bar")$"> <canvas id="chart-$CMS_VALUE(st_diagram_typ)$"></canvas> </div> <div id="legend-$CMS_VALUE(st_diagram_typ)$" class="legend-$CMS_VALUE(st_legend_column, default: 1)$col"></div> <!-- Inline Konfig, hier ersetzt CMS Werte in reine JS Variablen --> <script> window.chartConfigs = window.chartConfigs || []; window.chartConfigs.push({ canvasId: "chart-$CMS_VALUE(st_diagram_typ)$", type: "$CMS_VALUE(st_diagram_typ, default:"bar")$", apiEndpoint: "$CMS_VALUE(st_api_endpoint)$", chartColors: [$CMS_VALUE(st_chart_color)$], barThickness: $CMS_VALUE(st_chart_bar_thinkness, default:40)$, apiRefresh: $CMS_VALUE(st_api_refresh, default:60000)$, showGrid: $CMS_VALUE(st_chart_grid, default:true)$ }); </script> </div>
Grüsse
Thomas
-
Author: hoebbel - 6/3/2025 9:11
Hallo Thomas,
wenn ich es richtig sehe, dann gibst Du die Catalog-Card wahrscheinlich direkt aus. Dann kannst Du über $CMS_VALUE(#card.getId())$ eine UUID erzeugen, die eindeutig ist und sich nicht ändert.
Viele Grüße
Holger0 -
Author: th_biedermann - 6/3/2025 12:34
Hallo Holger
Danke für den Tipp. Ja ich gebe die Catalog-Card direkt aus
Ich habe folgendes verbaut: id="chart-$CMS_VALUE(#card.getId())$" -> das ergibt bei mir LEER -> siehe <canvas id="chart-"
<div class="chart-container-canvas-pie"> <canvas id="chart-" data-type="pie" data-api-endpoint="getskidayvalue" data-colors="#eb3c24,#000,#5f5f5f,#999999,#cccccc" data-refresh="10000" data-show-grid="false" data-bar-thickness="40" style="box-sizing: border-box; display: block; height: 300px; width: 300px;" width="900" height="900"></canvas> </div>Habe ich was falsch verstanden oder gemacht.
Grüsse
Thomas
0 -
Author: hoebbel - 6/3/2025 12:56
Hallo Thomas,
ich fürchte, ich habe mich nicht sauber genug ausgedrückt.
Mit "direkter Ausgabe der Card" meinte ich eigentlich direkte Ausgabe des Catalogs.
Also das Du $CMS_VALUE(myCatalog)$ im umgebenen Template benutzt. Nur dann steht das #card Objekt zur Verfügung.Benutzt Du statt dessen
$CMS_FOR(myCard,myCatalog)$$CMS_VALUE(myCard)$$CMS_END_FOR$
dann steht das #card Objekt nicht zur Verfügung.Also einfach den Aufruf im umgebenen Template entsprechend abändern, dann sollte es klappen.
Alternativ kannst Du statt dessen #for.index verwenden, wenn Du den Catalog mittels CMS_FOR ausgibst. Dann sind die Identifier durchnummeriert von 0 bis AnzahlCards.
Viele Grüße
Holger0 -
Author: th_biedermann - 6/3/2025 13:33
Hallo Holger
DANKE für die Klarstellung
Ich habe nun die Ausgabe vom ITEM ins Haupttemplate verschoben. Ich habe aber leider immer noch keine UUID.
#for.index -> hier habe ich 0 - X -> aber das ist zu uneindeutig
$-- LOOP THROUGH CHART ITEMS --$ $CMS_FOR(x, st_chart_container)$ <div class="image-text-block" $CMS_VALUE(if(#global.preview, editorId(), ""))$> $CMS_IF(#global.preview)$ DEBUG: "-$CMS_VALUE(#for.index)$-" $CMS_END_IF$ $CMS_IF(!x.item.st_copytext.isEmpty())$ <div class="atom-copytext $CMS_VALUE(if(set_hyphenate == "true", "auto-hyphenate", ""))$" style="padding-bottom:50px;"> $CMS_VALUE(x.item.st_copytext)$ </div> $CMS_END_IF$ <div class="chart-container-canvas-$CMS_VALUE(x.item.st_diagram_typ, default: "bar")$"> <canvas id="chart-$CMS_VALUE(#card.getId())$" data-type="$CMS_VALUE(x.item.st_diagram_typ, default: "bar")$" data-api-endpoint="$CMS_VALUE(x.item.st_api_endpoint)$" data-colors="$CMS_VALUE(x.item.st_chart_color.replaceAll(" ", ""), default: "#eb3c24,#000")$" data-refresh="$CMS_VALUE(x.item.st_api_refresh, default: 60000)$" data-show-grid="$CMS_VALUE(x.item.st_chart_grid, default: "true")$" $CMS_IF(x.item.st_diagram_typ == "bar")$data-bar-thickness="$CMS_VALUE(x.item.st_chart_bar_thinkness, default: 40)$"$CMS_END_IF$ ></canvas> </div> <div id="legend-$CMS_VALUE(#card.getId())$" class="legend-$CMS_VALUE(x.item.st_legend_column, default: 1)$col"></div> </div> $CMS_END_FOR$Grüsse
Thomas
0 -
Author: th_biedermann - 6/3/2025 13:41
Hallo Holger
Ich habe den Fehler gefunden.
Es darf nicht $CMS_VALUE(#card.getId())$ lauten sondern in meinem Fall $CMS_VALUE(x.getId())$
<div id="legend-79c6ad53-0bec-428a-9110-bdcbc7261670" class="legend-2col"></div>
Dann habe ich die UUID
Grüsse
Thomas
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
5 commentaires