Created
October 1, 2016 17:36
-
-
Save pmfx/5613455a9d0c110e4c0dc18c057cf8b4 to your computer and use it in GitHub Desktop.
Get first picture path from EvoGallery MODX snippet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$output=''; | |
if($id){ | |
$table = $modx->getFullTableName( 'portfolio_galleries' ); | |
$query = $modx->db->query('SELECT content_id,filename,sortorder FROM '.$table.' WHERE content_id='.$id.' ORDER BY sortorder ASC LIMIT 0,1'); | |
$row = $modx->db->getRow($query); | |
$gal_id = $row['content_id']; | |
$gal_filename = $row['filename']; | |
if ($row){ | |
$output = 'assets/galleries/'.$gal_id.'/'.$gal_filename; | |
} | |
} | |
return $output; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment