Dieser Artikel bezieht sich auf CodeCharge Studio 4.01.00.06. Andere Versionen könnten sich abweichend verhalten!
Seit ein paar Wochen arbeite ich an einem Projekt, welches die Vorgabe hat, komplett in CodeCharge enwickelt zu werden. Dabei bin ich immer wieder an die Grenzen dieses mächtigen Werkzeuges gestossen. Ein häufiges Problem ist für mich, die Custom-Block-Möglichkeiten der Template-Klasse an Stellen zu verwenden, die CodeCharge anscheinend nicht dafür vorgesehen hat und daher nicht ohne weiteres zulässt.
Es gibt drei unterschiedlich zu behandelnde Fälle, Custom Blocks zu plazieren, soweit ich das überblicke:
- in der obersten Ebene, ausserhalb aller Components
Hier gibt es gar keine Probleme. Man kann seine Custom Blocks einfach definieren:<!-- BEGIN mein_custom_block --> mein html code undso mit {meine_variable} <!-- END mein_custom_block -->
und per benutzerdefinierten PHP-Code z.B. im „Before Show“-Event der Seite so verwenden:
global $Tpl; $first = true; foreach ($mein_array as $element) { $Tpl->SetVar("meine_variable", element); $Tpl->Parse("mein_custom_block", !$first); $first = false; }
- innerhalb eines Blockes (z.B. Row) einer Component (z.B. Grid)
Das funktioniert fast genauso. Man muss der Template-Klasse nur die eigene Block-Variable nennen:global $Tpl; $first = true; $Tpl->SetBlockVar("mein_custom_block",""); foreach ($mein_array as $element) { $Tpl->SetVar("meine_variable", element); $Tpl->Parse("mein_custom_block", !$first); $first = false; }
Diese ersten beiden Fälle sind auch dokumentiert: Working with Custom Template Blocks
- innerhalb eines Panels (bzw. Update-Panels)
Will man einen Custom-Block innerhalb eines Panels verwenden, was ja das Mittel der Wahl sein soll, sobald man ganze Bereiche der Webseite einfach ein bzw. ausblenden muss (z.B. wegen Zugangsberechtigungen), dann funktionieren die ersten beide Vorgehensweisen nicht mehr. Custom-Blöcke werden hier nicht berücksichtigt, ja sogar vor dem Anzeigen entfernt.Das liegt daran, dass der Template-Klassen-interne Zeiger auf der darüberliegenden Ebene stehen bleibt, sobald man sich im „before show“-Ereignis des Panels befindet.
Die Abhilfe dazu sieht so aus, dass man- sich die aktuelle Position des Template-Klassen-Zeigers merkt (in unserem Fall müsste „/main“ darin stehen),
- dann den Zeiger mit dem Panel-Pfad-Überschreibt (z.B. „/main/Panel mein_panel“),
- hier wie bei den anderen beiden Fällen, die Template-Operationen durchführt und
- danach den Zeiger wieder auf den ursprünglichen Punkt richtet (also in unserem Beispiel wieder auf „/main“).
global $Tpl; // (1): $aktueller_zeiger = $Tpl->block_path; // (2): $Tpl->block_path = $aktueller_zeiger . "/Panel mein_panel"; // (3): $first = true; foreach ($mein_array as $element) { $Tpl->SetVar("meine_variable", element); $Tpl->Parse("mein_custom_block", !$first); $first = false; } // (4): $Tpl->block_path = $aktueller_zeiger;
Benötigt man übrigens in seinem Panel lediglich eine Template-Variable (also {meine_variable}) ohne einen Custom-Block, so braucht man sich nicht mit diesem Workaround abgeben. Template-Variablen alleine funktionieren innerhalb von Panels wie gewohnt und völlig problemlos.
achat cialis 20mg vente de cialis sans ordonnance prix du cialis boite de 8 cialis ou viagra ou levitra
nakrutka
cialis 100mg dosage viagra essential oil best way to take cialis cialis what is it
uletay.net
viagra soft viagra 100 mg precio comprar viagra sin receta en farmacias que es la viagra
rui nolvadex buy nolvadex 10mg sale 20 mg ed of nolvadex for gyno how much nolvadex do i take with testosterone
olumiant 4mg baricitinib 4 mg tablet baricitinib ж—Ґжњ¬гЃ® baricitinib and its jak inhibitor
. baricitinib in patients with refractory rheumatoid arthritis. olumiant generic baricitinib cost in india baricitinib in covid 19
latisse rx coupon bimatoprost ophthalmic solution buy online eyelash products similar to latisse how much is prescription for latisse
zanaflex drug test zanaflex tablets does the military screen for zanaflex how long after zanaflex can i take benadryl
aralen and arthritis chloroquine for sale oct findings in aralen toxicity what are the side effects of aralen?
molnupiravir merck press release molnupiravir tablets molnupiravir viet nam molnupiravir brand name
4mg zanaflex zanaflex prescription price how to prep zanaflex for injection what is the highest dose of zanaflex
aralen generic shortage chloroquine nz does aralen caus stiff legs how does aralen interact with percocet
rory latisse review latisse for eyebrows who sells latisse near me how long does latisse take to work
cheap nolvadex purchase tamoxifen citrate is nolvadex over the counter how to aquire nolvadex
luvox and zanaflex buy generic tizanidine bad side effects from zanaflex what is zanaflex 4 mg used
clomid dosing buy generic clomid uk where can i get clomid and nolvadex how to take clomid pills
latisse samples bimatoprost eyelash rodan and fields vs latisse what is latisse from rory
purchase plaquenil generic – order plaquenil 200mg online cheap plaquenil drug
накрутка
avodart 0.5mg for sale – generic avodart 0.5mg cialis on line
sildenafil dapoxetine combination dapoxetine 30mg tablet dapoxetine require prescription in gernany what is priligy 60 mg (dapoxetine)
kamagra ervaringen kamagra australia buy kamagra effervescent baikal-pharmacy.com where is the nearest place that sells kamagra jelly
diltiazem 60 cardizem 120 mg cd diltiazem rash cheeks should i discontinue med medicine what is diltiazem
azithromycin nausea azithromycin over the counter uk is zithromax free at publix how to take azithromycin 250mg tablets
zithromax shelf life zithromax 1000 mg for sale how to take azithromycin tablets azithromycin how fast does it work
cialis precio cialis buy australia 100mg viagra how long does it last viagra not working why
ventolin hfa uses how to buy albuterol tabs online without a prescription how much is albuterol inhaler without insurance what is albuterol sulfate syrup
cialis viagra acheter cialis en toute confiance cialis original 20 mg 12 comprimГ©s ou acheter du cialis en toute confiance
cenforce 200 penis cenforce 100mg tablets cenforce 100 contrareembolso what happens if i take 200mg of viagra
cialis belgique forum achat cialis angleterre pharmacie en ligne belgique cialis cialis viagra ou levitra
lasix online lasix uk buy lasix for dogs 12.5 mg why is lasix pushed over 2 minutes
clomid online cheap buy generic clomid does clomid lower estrogen levels what day do you ovulate on clomid
paxil vs celexa paroxetine 40 mg price difference between prozac and paxil what are the long term effects of paxil
monistat vs diflucan diflucan 150 australia diflucan second dose 48 hours where can i buy diflucan
baricitinib 2mg baricitinib buy online baricitinib genГ©rico baricitinib powder
diflucan discount can i buy diflucan online diflucan over the counter alternative how long for diflucan to work men
diflucan prescribing info how much is diflucan can you drink on diflucan how long is diflucan in your system
prednisone anger prednisone 2.5 mg cost does prednisone cause dry mouth what is prednisone 20 mg tablets used for?
ivermectin avian ivermectin oral liquid ivermectin dose for dogs how does ivermectin work on scabies
xenical canada xenical online pharmacy orlistat 120 para que sirve how much wight loss using xenical
cheap online xenical para que sirve orlistat medicina orlistat para que sirve how much fat does 120 mg xenical remove
diflucan during pregnancy order fluconazol can you get diflucan over the counter what is diflucan dose for yeast infection
xenical dosages orlistat prescription uk xenical or alli which is better how fast do you lose weight after starting xenical
orlistat user reviews over the counter orlistat canada how much is orlistat without insurance how xenical works
paxil nausea paxil 20 mg cost paxil and drinking alcohol side effects what does 10mg of paxil do
baricitinib in patients with refractory rheumatoid arthritis wiki baricitinib price has fda approved olumiant in us baricitinib fact sheet for patients
seroquel dosage how much is quetiapine canada normal dose of seroquel for sleep how to stop eating on seroquel
is molnupiravir fda approved pill for covid merck molnupiravir molnupiravir about half merck cuts covid19