Skip to content

Instantly share code, notes, and snippets.

@yama
Created January 27, 2017 12:14
Show Gist options
  • Save yama/6087240367b7dea9a29cb47c2a35f541 to your computer and use it in GitHub Desktop.
Save yama/6087240367b7dea9a29cb47c2a35f541 to your computer and use it in GitHub Desktop.
MODXでリソースID・ページタイトルなどと同時にテンプレート変数の値も取得する(2)
SELECT
sc.id,
pagetitle,
addr.value AS 住所,
tel.value AS 電話番号
FROM modx_site_content sc
LEFT JOIN modx_site_tmplvar_contentvalues addr ON sc.id=addr.contentid AND addr.tmplvarid=3
LEFT JOIN modx_site_tmplvar_contentvalues tel ON sc.id=tel.contentid AND tel.tmplvarid=5
WHERE sc.parent=3
LIMIT 50
# https://gist.github.com/yama/aa97a5cb19c3a9060af51e55a545806e こっちのより軽いかも?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment