1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-14 02:24:08 +02:00

Gallery portfolio template added.

This commit is contained in:
Cameron
2017-01-01 10:12:47 -08:00
parent 062f80d1b0
commit fdd97fb625
3 changed files with 56 additions and 5 deletions

View File

@@ -268,7 +268,14 @@ class cpage_shortcodes extends e_shortcode
return "<!-- Button Removed: No page text exists! -->"; return "<!-- Button Removed: No page text exists! -->";
} }
parse_str($parm,$options); if(is_string($parm))
{
parse_str($parm,$options);
}
else
{
$options= $parm;
}
$buttonText = (empty($this->var['menu_button_text'])) ? LAN_READ_MORE : $this->var['menu_button_text']; $buttonText = (empty($this->var['menu_button_text'])) ? LAN_READ_MORE : $this->var['menu_button_text'];
$buttonUrl = (empty($this->var['menu_button_url'])) ? $url : $tp->replaceConstants($this->var['menu_button_url']); $buttonUrl = (empty($this->var['menu_button_url'])) ? $url : $tp->replaceConstants($this->var['menu_button_url']);

View File

@@ -38,13 +38,21 @@ class gallery_shortcodes extends e_shortcode
function sc_gallery_caption($parm = '') function sc_gallery_caption($parm = '')
{ {
$tp = e107::getParser();
if($parm === 'text')
{
return $tp->toAttribute($this->var['media_caption']);
}
e107_require_once(e_PLUGIN . 'gallery/includes/gallery_load.php'); e107_require_once(e_PLUGIN . 'gallery/includes/gallery_load.php');
// Load prettyPhoto settings and files. // Load prettyPhoto settings and files.
gallery_load_prettyphoto(); gallery_load_prettyphoto();
$plugPrefs = e107::getPlugConfig('gallery')->getPref(); $plugPrefs = e107::getPlugConfig('gallery')->getPref();
$hook = varset($plugPrefs['pp_hook'], 'data-gal'); $hook = varset($plugPrefs['pp_hook'], 'data-gal');
$tp = e107::getParser();
$text = "<a class='gallery-caption' title='" . $tp->toAttribute($this->var['media_caption']) . "' href='" . $tp->thumbUrl($this->var['media_url'], $this->attFull) . "' " . $hook . "='prettyPhoto[slide]' >"; // Erase rel"lightbox.Gallery2" - Write "prettyPhoto[slide]" $text = "<a class='gallery-caption' title='" . $tp->toAttribute($this->var['media_caption']) . "' href='" . $tp->thumbUrl($this->var['media_url'], $this->attFull) . "' " . $hook . "='prettyPhoto[slide]' >"; // Erase rel"lightbox.Gallery2" - Write "prettyPhoto[slide]"
$text .= $this->var['media_caption']; $text .= $this->var['media_caption'];
$text .= "</a>"; $text .= "</a>";
@@ -210,6 +218,7 @@ class gallery_shortcodes extends e_shortcode
function sc_gallery_portfolio($parms = '') function sc_gallery_portfolio($parms = '')
{ {
$ns = e107::getRender(); $ns = e107::getRender();
$tp = e107::getParser();
$parm = eHelper::scParams($parms); $parm = eHelper::scParams($parms);
$cat = (!empty($parm['category'])) ? $parm['category'] : vartrue(e107::getPlugPref('gallery', 'slideshow_category'), false); //TODO Separate pref? $cat = (!empty($parm['category'])) ? $parm['category'] : vartrue(e107::getPlugPref('gallery', 'slideshow_category'), false); //TODO Separate pref?
@@ -219,7 +228,9 @@ class gallery_shortcodes extends e_shortcode
$plugPrefs = e107::getPlugConfig('gallery')->getPref(); $plugPrefs = e107::getPlugConfig('gallery')->getPref();
$orderBy = varset($plugPrefs['orderby'], 'media_id DESC'); $orderBy = varset($plugPrefs['orderby'], 'media_id DESC');
$imageQry = (empty($cat)) ? "gallery_image|gallery_image_1|gallery_1" : 'gallery_' . $cat . '|gallery_image_' . $cat; $imageQry = (empty($cat) || $cat==1) ? "gallery_image|gallery_image_1|gallery_1" : 'gallery_' . $cat . '|gallery_image_' . $cat;
$list = e107::getMedia()->getImages($imageQry, 0, $limit, null, $orderBy); $list = e107::getMedia()->getImages($imageQry, 0, $limit, null, $orderBy);
@@ -233,12 +244,37 @@ class gallery_shortcodes extends e_shortcode
} }
} }
$template = e107::getTemplate('gallery', 'gallery', 'portfolio');
if(!empty($template['start']))
{
$text = $tp->parseTemplate($template['start'],true, $this);
}
else
{
$text = '';
}
//NOTE: Using tablerender() allows the theme developer to set the number of columns etc using col-xx-xx //NOTE: Using tablerender() allows the theme developer to set the number of columns etc using col-xx-xx
$text = '';
foreach($list as $val) foreach($list as $val)
{ {
$this->var = $val; $this->var = $val;
$text .= $ns->tablerender('', $this->sc_gallery_thumb('class=gallery_thumb img-responsive img-home-portfolio'), 'gallery_portfolio', true);
if(empty($template['item']))
{
$text .= $ns->tablerender('', $this->sc_gallery_thumb('class=gallery_thumb img-responsive img-home-portfolio'), 'gallery_portfolio', true);
}
else
{
$text .= $tp->parseTemplate($template['item'],true,$this);
}
}
if(!empty($template['end']))
{
$text .= $tp->parseTemplate($template['end'],true, $this);
} }
return $text; return $text;

View File

@@ -179,3 +179,11 @@ $GALLERY_TEMPLATE['prettyphoto']['social_item'] = '
</div> </div>
</div> </div>
'; ';
/*
$GALLERY_TEMPLATE['portfolio']['start'] = '<-- start portfolio -->';
$GALLERY_TEMPLATE['portfolio']['item'] = '<img src="{GALLERY_THUMB: w=1080&h=720&thumbsrc}" class="img-responsive" alt="{GALLERY_CAPTION=text}">';
$GALLERY_TEMPLATE['portfolio']['end'] = '<-- end portfolio -->';
*/