Closed zonky2 closed 10 years ago
erster Teilerfolg: das DB-Statement funktioniert!
die Klammern wurden umgewandelt daher muss der Code wie folgt aussehen:
_code
switch( $arrRow['conditionType'] )
{
case 'database':
try
{
// For some reason, = is escaped in the string!
$query = trim(str_replace('=', '=', $query));
$query = trim(str_replace('(', '(', $query));
$query = trim(str_replace(')', ')', $query));
$query = $this->Database->prepare($query)->execute()->fetchRow();
$query = $query[0];
}
// Something went wrong with the database query. Use as text instead
catch(Exception $e)
{
$query = $this->replaceInsertTags($arrRow['conditionQuery']);
//print_r($this->Database->prepare($query));
}
break;
}
_code
weiterhin habe ich festgestellt, dass der "Tag" {{date::D}} per $this->replaceInsertTags nicht umgewandelt wird - andere tags funktionieren...??
die Ersetzung für {{date::*}} muss mit "false" erfolgen
Code:
if ($arrRow['useCondition'])
{
$query = $this->replaceInsertTags($arrRow['conditionQuery'], false);
switch( $arrRow['conditionType'] )
{
case 'database':
try
{
// For some reason, = is escaped in the string!
$query = trim(str_replace('=', '=', $query));
$query = trim(str_replace('(', '(', $query));
$query = trim(str_replace(')', ')', $query));
$query = $this->Database->prepare($query)->execute()->fetchRow();
$query = $query[0];
}
// Something went wrong with the database query. Use as text instead
catch(Exception $e)
{
$query = $this->replaceInsertTags($arrRow['conditionQuery'], false);
}
break;
}
//echo "query2: ".$query."<br>";
switch( $arrRow['conditionFormula'] )
{
Hallo Andreas,
kommt das
irgendwann in das Tool? ich muss bei jedem Update die Datei wieder überschreiben...
ich will eine Abfrage zum aktuellen Wochentag durchführen - die will nicht :-(
Folgende Einstellunegn:
Bedingung: Typ: Text Formel: Gleich Abfrage: {{date::D}} Wert: Do
habe es auch probiert mit:
Abfrage: {{date::N}} Wert: 4
und
Typ: SQL Formel: Gleich Abfrage: SELECT DAYOFWEEK(CURDATE()) Wert: 5
siehe https://community.contao.org/de/showthread.php?44493-inserttags-Abfrage-funktioniert-nicht