Zitat von
n00b
Als Php-Noob habe ich da Probleme, kann mir jemand helfen? Kann ich überhaupt per Php prüfen, ob ein einzelner newsbeitrag public ist?
Ja, und du musst das nicht im fe_page Template machen, sondern evt. am besten direkt im moo_mediabox Template. zB:
PHP-Code:
<?php
// Add the mediabox style sheet
$GLOBALS['TL_CSS'][] = 'assets/mootools/mediabox/'. $GLOBALS['TL_ASSETS']['MEDIABOX'] .'/css/mediaboxAdvBlack21.css|static';
?>
<script src="<?= TL_ASSETS_URL ?>assets/mootools/mediabox/<?= $GLOBALS['TL_ASSETS']['MEDIABOX'] ?>/js/mediabox.js"></script>
<script>
(function($) {
window.addEvent('domready', function() {
$$('a[data-lightbox]').mediabox({
// Put custom options here
}, function(el) {
return [el.href, el.title, el.getAttribute('data-lightbox')];
}, function(el) {
var data = this.getAttribute('data-lightbox').split(' ');
return (this == el) || (data[0] && el.getAttribute('data-lightbox').match(data[0]));
});
$('mbImage').addEvent('swipe', function(e) {
(e.direction == 'left') ? $('mbNextLink').fireEvent('click') : $('mbPrevLink').fireEvent('click');
});
<?php
if (($objNews = \NewsModel::findById(9999)) !== null):
if ($objNews->published): ?>
Mediabox.open('#mb_popup', '', '300 262');
<?php endif; ?>
<?php endif; ?>
});
})(document.id);
</script>
Lesezeichen