update(News DashboardWidget): updates how to betreff is queried from the XML

This commit is contained in:
SimonGschnell
2025-01-21 14:20:40 +01:00
parent 381b6a75db
commit d72bc4fa44
3 changed files with 43 additions and 24 deletions
+13 -1
View File
@@ -43,7 +43,7 @@ class CmsLib
* @param string $sprache
* @param boolean $sichtbar
*
* @return void
* @return stdClass
*/
public function getContent($content_id, $version = null, $sprache = null, $sichtbar = true)
{
@@ -105,7 +105,19 @@ class CmsLib
if($content->titel){
$betreff = $content->titel;
}else{
//DomDocument getElementsByTagName returns a DomNodeList
$betreff = $XML->getElementsByTagName('betreff');
//check if any betreff was found and if it is not empty
if($betreff->length > 0 && !empty($betreff->item(0)->nodeValue))
{
//DomNodeList item() return a DomNode, property nodeValue contains the value of the node
$betreff = $betreff->item(0)->nodeValue;
}
else
{
return error('no betreff found for the content');
}
}
$xsltemplate = new DOMDocument();