Hallo,
ich hätte eine Frage zu den Core Objects.
Unter den Templates kann ich meine eigene hinzugefügte Core Objekt ohne Probleme aufrufen und anzeigen lassen, allerdings frage ich mich, ob man diesen auch in SCSS einfügen kann.
Ich würde gerne in SCSS eine Abfrage machen und diesbezüglich mein Core Objekt mit einbeziehen. Geht das?
Mein Code:
<coreobject>
<objectname>wcf\system\test\TestExampleHandler</objectname>
</coreobject>
<?php
namespace wcf\system\test;
use wcf\system\SingletonFactory;
class TestExampleHandler extends SingletonFactory {
public function getvalue() {
$data = 1;
// WCF::getTPL()->assign([
// 'dataObject' => $data,
// ]);
return $data;
}
}
Display More
Aufruf im Template: {@$__wcf->getTestExampleHandler()->getvalue()}
( Das Funktioniert )
Nur wie kann ich das in SCSS in eine Variable einfügen oder eine Abfrage machen?
Folgendes habe ich versucht:
$myVariable: #{@$__wcf->getTestExampleHandler()->getvalue()}; // GEHT NICHT
$myVariable: #{#$__wcf->getTestExampleHandler()->getvalue()}; // GEHT NICHT
$myVariable: {@$__wcf->getTestExampleHandler()->getvalue()}; // GEHT NICHT
@if {@$__wcf->getTestExampleHandler()->getvalue()} == 1 { // GEHT NICHT
...
}
@if #{@$__wcf->getTestExampleHandler()->getvalue()} == 1 { // GEHT NICHT
...
}
Display More
Habe mir auch in der Woltlab Doku folgendes angeschaut:
Template Variables
Template variables can be assigned via
WCF::getTPL()->assign('foo', 'bar')
and accessed in templates via$foo
:
{$foo}
will result in the contents of$foo
to be passed toStringUtil::encodeHTML()
before being printed.{#$foo}
will result in the contents of$foo
to be passed toStringUtil::formatNumeric()
before being printed. Thus, this method is relevant when printing numbers and having them formatted correctly according the the user’s language.{@$foo}
will result in the contents of$foo
to be printed directly. In general, this method should not be used for user-generated input.System Template Variable
The template variable
$tpl
is automatically assigned and is an array containing different data:
$__wcf
contains theWCF
object (orWCFACP
object in the backend).
und
Ich vermute das ich es nicht richtig escape...
Hoffe ihr könnt mir helfen