dbConfig['table_prefix']; $contentTable=$prefix."site_content"; $tplVarTable=$prefix."site_tmplvar_contentvalues"; $tmplvarid=3; if (!$allContents) { $sql="SELECT id FROM %s WHERE parent='%s' AND published!=0 ORDER BY menuindex ASC"; $sql=sprintf($sql, $contentTable, $pid); $result=$modx->dbQuery($sql); while ($row=mysql_fetch_assoc($result)) { $allContents[]=$row["id"]; } } if (count($allContents)<1) return; if (!$bannerContents) { $ids=implode(",", $allContents); $sql="SELECT contentid FROM %s WHERE tmplvarid=%s AND contentid IN (%s)"; $sql=sprintf($sql, $tplVarTable, $tmplvarid, $ids); $result=$modx->dbQuery($sql); while ($row=mysql_fetch_assoc($result)) { $bannerContents[]=$row["contentid"]; } } if (!$textContents) { foreach ($allContents as $id) { if (is_int(array_search($id, $bannerContents))) continue; $textContents[]=$id; } } $res=""; if ($type=="image" && count($bannerContents)>0) { $ids=implode(',', $bannerContents); $sql="SELECT contentid, value FROM %s WHERE tmplvarid=%s AND contentid IN (%s)"; $sql=sprintf($sql, $tplVarTable, $tmplvarid, $ids); $result=$modx->dbQuery($sql); while ($row=mysql_fetch_assoc($result)) { $images[$row["contentid"]]=$row["value"]; } $sql="SELECT id, pagetitle, introtext FROM %s WHERE id IN (%s) ORDER BY menuindex ASC"; $sql=sprintf($sql, $contentTable, $ids); $result=$modx->dbQuery($sql); while ($row=mysql_fetch_assoc($result)) { $res.='
'; $res.= ''; $res.= ''.$row['; $res.= ''; $res.= '
'; $res.= ''; $res.= $row["pagetitle"]; $res.= ''; $res.= '
'; $res.='
'; $res.='

'; } } elseif ($type=="text" && count($textContents)>0) { $ids=implode(',', $textContents); $sql="SELECT id, pagetitle, introtext FROM %s WHERE id IN (%s) ORDER BY menuindex ASC"; $sql=sprintf($sql, $contentTable, $ids); $result=$modx->dbQuery($sql); while ($row=mysql_fetch_assoc($result)) { $res.='

'; $res.= ''; $res.= $row["pagetitle"]; $res.= ''; $res.='

'; $res.='

'.nl2br($row["introtext"]).'

'; } } // type 指定なし。すべてのコンテンツをメニューインデックス順に出力 elseif (empty ($type)) { // CSS $css=<< EOF; $modx->regClientCSS($css); $ids=implode(',', $allContents); // バナー画像の取得 $sql="SELECT contentid, value FROM %s WHERE tmplvarid=%s AND contentid IN (%s)"; $sql=sprintf($sql, $tplVarTable, $tmplvarid, $ids); $result=$modx->dbQuery($sql); while ($row=mysql_fetch_assoc($result)) { $images[$row["contentid"]]=$row["value"]; } // コンテンツ取得 $sql="SELECT id, pagetitle, introtext,longtitle FROM %s WHERE hidemenu=0 AND id IN (%s) ORDER BY menuindex ASC"; $sql=sprintf($sql, $contentTable, $ids); $result=$modx->dbQuery($sql); $res.=''; } return $res; ?>