Skip to content

Instantly share code, notes, and snippets.

@yordanzhelevdev
Created January 31, 2020 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yordanzhelevdev/1e84aacd1f0118843d735db20aeea5da to your computer and use it in GitHub Desktop.
Save yordanzhelevdev/1e84aacd1f0118843d735db20aeea5da to your computer and use it in GitHub Desktop.
fns-data-backup
function gallery_data($id, $section_id = 12, $limit = 100, $type = 1) {
$order = 'res_order, res_id';
if ($section_id == $GLOBALS['s_products']) {
if ($GLOBALS['row']['prod_parent']) $order = 'res_order > 0 DESC, res_order';
else if (strpos($id, ',') !== false && $GLOBALS['row']['prod_id']) $order = "page_id != {$GLOBALS['row']['prod_id']} DESC, ".$order;
}
$res = query("SELECT *
FROM wf_resources
WHERE page_id IN ($id) AND section_id = $section_id AND res_type = $type
ORDER BY res_type, $order LIMIT $limit");
return num_rows($res) ? $res : false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment