Created
July 4, 2014 08:08
-
-
Save dmlogic/12261e9b1aba873d2366 to your computer and use it in GitHub Desktop.
Run any string as ExpresisonEngine channel::entries. Also supports search field
This file contains 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 | |
/** | |
* Allows an arbirary string to be parsed as Channel Entries markup | |
*/ | |
use Channel; | |
class PsuedoChannelEntries { | |
public function entries($tagparams,$tagdata,$search_fields = []) | |
{ | |
$this->setup($tagparams,$tagdata,$search_fields); | |
$CH = new Channel(); | |
$CH->enable['custom_fields'] = 1; | |
return $CH->entries(); | |
} | |
//-------------------------------------------------------------------------- | |
private function setup($tagparams,$tagdata,$search_fields) | |
{ | |
ee()->TMPL->tagparams = $tagparams; | |
ee()->TMPL->tagdata = $tagdata; | |
ee()->TMPL->search_fields = $search_fields; | |
$vars = ee()->functions->assign_variables($tagdata, '/'); | |
ee()->TMPL->var_single = $vars['var_single']; | |
ee()->TMPL->var_pair = $vars['var_pair']; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment