Hallo, lieber Forum Benutzer. Wir haben in letzter Zeit festgestellt, dass die Kommunikation via https://slack.com/ viel schneller und zielführender ist als ein Beitrag im Forum. Aufgrund der neuen Möglichkeiten der Kommunikation ist das Forum ein wenig eingeschlafen und weniger Nutzer benutzen das Forum aktiv (trotzdem lohnt es sich evtl. hier nach Lösungen zu suchen oder seine Frage zu stellen).

Wir empfehlen bei Fragen/Problemen aktuell die Frage (zusätzlich) im Slack zu stellen. Dort sind viele kompetente REDAXO Benutzer aktiv und beantworten gerne (Anfänger)Fragen.

Selbst einladen kannst Du dich hier: http://redaxo.org/slack/

Slack wird von uns sehr intensiv und meistens "rund um die Uhr" benutzt :-)
Garfield
Beiträge: 49
Registriert: 1. Okt 2006, 19:01

Gallery Modul in eigenes Template einbinden

2. Nov 2018, 10:35

Hallo zusammen,

ich experimentiere mit dem Umstieg von Redaxo 3.x und 4x Versionen auf die aktuelle 5.6.4 und habe mir ein Testsystem installiert mit der Demo.

Im Demo-Template wird die Galerie im Frontend perfekt mit Thumbnails und der Möglichkeit, die Bilder zu vergrößern, angezeigt (Link 1).

In meinem Test-Template erscheinen die Bilder aber falsch (Link 2). Jaja, bitte nicht über das Layout lachen, ist nur ein Test :wink:

Ich vermute, dass ich noch irgendwas in mein eigenes Template einbinden muss, damit die Darstellung stimmt, komme aber einfach nicht dahinter, was da fehlt.

Code des Original-Templates (habe alles in eine einzige Template-Datei gepackt):

Code: Alles auswählen

<?php
define('SITE_TYPE', 'col1');

// URL-Rewrite-Anweisungen:
      $seo = new rex_yrewrite_seo();
      echo $seo->getTitleTag().PHP_EOL;
      echo $seo->getDescriptionTag().PHP_EOL;
      echo $seo->getRobotsTag().PHP_EOL;
      echo $seo->getHreflangTags().PHP_EOL;
      echo $seo->getCanonicalUrlTag().PHP_EOL;

// error_reporting(0);
error_reporting(E_ALL);
// Error report should only be active during development. Deavtivate (0) on a live website

$page_is_visible = true;

// Is current article offline?
if (rex_article::getCurrent()->isOnline() == 0) {
	$page_is_visible = false;
}

// is online_from_date newer than actual date?
if (rex_article::getCurrent()->getValue('art_online_from') != '' && rex_article::getCurrent()->getValue('art_online_from') > time()) {
	$page_is_visible = false;
}

// is online_from_date older than actual date
if (rex_article::getCurrent()->getValue('art_online_to') != '' && rex_article::getCurrent()->getValue('art_online_to') < time()) {
	$page_is_visible = false;
}


// Is User not logged in?
if (!rex_backend_login::hasSession()) {
	if ($page_is_visible == false) {
		// redirect to 404 page
		header ('HTTP/1.1 301 Moved Permanently');
		header('Location: '.rex_getUrl(rex_article::getNotFoundArticleId(), rex_clang::getCurrentId()));
		exit();
	}
}

// Necessary for input and output of module "Tabs und Akkordions"
rex::setProperty('tabs', new ArrayIterator());

// set charset to utf8
header('Content-Type: text/html; charset=utf-8');

// setLocale is a language meta field, set your individual locale informations per language
setlocale (LC_ALL, rex_clang::getCurrent()->getValue('clang_setlocale'));

?><!DOCTYPE html>
<html lang="<?php echo rex_clang::getCurrent()->getCode(); ?>">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<?php
	// Use article title as title-Tag, unless a custom title-tag is set
    if ($this->hasValue("art_title") && $this->getValue("art_title") != "") {
		$title = htmlspecialchars($this->getValue('art_title'));
	} else {
		$title = htmlspecialchars($this->getValue('name'));
	}

	echo '
	<title>'.$title.'</title>';

	// Keywords and description
	// If current article does not have keywords and description, take them from start article
	$keywords = "";
    if ($this->hasValue("art_keywords") && $this->getValue("art_keywords") != "") {
        $keywords = $this->getValue("art_keywords");
    } else {
        $home = new rex_article_content(rex_article::getSiteStartArticleId());
        if ($home->hasValue("art_keywords")) {
            $keywords = $home->getValue('art_keywords');
        }
    }

    $description = "";
    if ($this->hasValue("art_description") && $this->getValue("art_description") != "") {
        $description = $this->getValue("art_description");
    } else {
        $home = new rex_article_content(rex_article::getSiteStartArticleId());
        if ($home->hasValue("art_description")) {
            $description = $home->getValue('art_description');
        }
    }

	echo '
	<meta name="keywords" content="'.htmlspecialchars($keywords).'">';

	echo '
	<meta name="description" content="'.htmlspecialchars($description).'">';
	?>

	<link rel="stylesheet" href="<?= rex_url::base('resources/css/bootstrap.css') ?>">
	<link rel="stylesheet" href="<?= rex_url::base('resources/css/redaxo-demo.css') ?>">
	<link rel="stylesheet" href="<?= rex_url::base('resources/css/font-awesome.min.css') ?>">
	<link rel="stylesheet" href="<?= rex_url::base('resources/css/flexslider.css') ?>">
	<link rel="stylesheet" href="<?= rex_url::base('resources/css/menu.css') ?>">
	<link rel="stylesheet" href="<?= rex_url::base('resources/css/forms.css') ?>">
	<link rel="stylesheet" href="<?= rex_url::base('resources/css/prettify.css') ?>">

    <link rel="apple-touch-icon" sizes="180x180" href="<?= rex_url::base('resources/favicons/apple-touch-icon.png') ?>">
    <link rel="icon" type="image/png" sizes="32x32" href="<?= rex_url::base('resources/favicons/favicon-32x32.png') ?>">
    <link rel="icon" type="image/png" sizes="16x16" href="<?= rex_url::base('resources/favicons/favicon-16x16.png') ?>">

	<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
	<!--[if lt IE 9]>
		<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
		<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
	<![endif]-->
</head>

<body>

<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
	<div class="navbar-header">
	  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
		<span class="sr-only">Toggle navigation</span>
		<span class="icon-bar"></span>
		<span class="icon-bar"></span>
		<span class="icon-bar"></span>
	  </button>
	  <a class="navbar-brand" href="<?= rex_getUrl(rex_article::getSiteStartArticleId(), rex_clang::getCurrentId()) ?>"><img src="<?= rex_url::base('resources/css/images/logo.svg') ?>" alt="REDAXO CMS"></a>
	</div>
	<div class="navbar-collapse collapse navbar-right">
		<!-- Navigation -->
<!-- Sprachwechsler Anfang -->
<?php
// uncomment to show language array
// print_r(rex_clang::getAll());

$current_language = '';
$languages = '';


// two languages online -> only show link to other language
if (count(rex_clang::getAll(true)) == 2) {

	foreach (rex_clang::getAll(true) as $lang) {
		if (rex_clang::getCurrentId() != $lang->getValue('id')) {
			$languages = '
			<li class="lang-title visible-xs">{{ languages }}</li>
			<li class="lang">
				<a href="'.rex_getUrl($this->getValue('article_id'), $lang->getValue('id')).'" title="'.$lang->getValue('name').'">
					<span class="hidden-xs">'.$lang->getValue('code').'</span>
					<span class="visible-xs">'.$lang->getValue('name').'</span>
				</a>
			</li>';
		}
	}

	rex::setProperty('lang_switch', $languages);

// more than two languages online -> show dropdown, current language not clickable
} elseif (count(rex_clang::getAll(true)) > 2) {
	
	foreach (rex_clang::getAll(true) as $lang) {
		if (rex_clang::getCurrentId() == $lang->getValue('id')) {
			$current_language .= '
			<a href="#" title="'.$lang->getValue('name').'">
				<span class="hidden-xs">'.$lang->getValue('code').'</span>
				<span class="visible-xs">'.$lang->getValue('name').'</span>
			</a>';
		} else {
			$languages .= '
			<li class="dropdown-toggle">
				<a href="'.rex_getUrl($this->getValue('article_id'), $lang->getValue('id')).'" title="'.$lang->getValue('name').'">
					<span class="hidden-xs">'.$lang->getValue('code').'</span>
					<span class="visible-xs">'.$lang->getValue('name').'</span>
				</a>
			</li>';
		}
	}

	rex::setProperty('lang_switch', '<li class="lang-title visible-xs">{{ languages }}</li><li class="dropdown-toggle lang">' . $current_language . '<ul class="dropdown-menu">' . $languages . '</ul></li>');

}
?>
<!-- Sprachwechsler Ende -->
<?php
$path = explode("|",$this->getValue("path").$this->getValue("article_id")."|");
$path1 = ((!empty($path[1])) ? $path[1] : '');
$path2 = ((!empty($path[2])) ? $path[2] : '');

$nav_main = '';

foreach (rex_category::getRootCategories() as $lev1) {

	$hidden_ids = array(1,6);
	// hide Home- and footer-article in navigation

	$category_is_visible = true;
	// only visible if online_from and online_to is ok
	if ($lev1->getValue('art_online_from') != '' && $lev1->getValue('art_online_from') > time()) { $category_is_visible = false; }

	if ($lev1->getValue('art_online_to') != '' && $lev1->getValue('art_online_to') < time()) { $category_is_visible = false; }


	if ($lev1->isOnline(true) && (!in_array($lev1->getId(), $hidden_ids)) && $category_is_visible == true) {

		if ($lev1->getId() == $path1) {
			$nav_main .= '
			<li class="dropdown-toggle active"><a href="'.$lev1->getUrl().'">'.htmlspecialchars($lev1->getValue('name')).'</a>';
		} else {
   			$nav_main .= '
			<li class="dropdown-toggle"><a href="'.$lev1->getUrl().'">'.htmlspecialchars($lev1->getValue('name')).'</a>';
		}

		// 1st level start
		$lev1Size = sizeof($lev1->getChildren());

			if ($lev1Size != "0") {

				$nav_main .= '
				<ul class="dropdown-menu">';

					// START 2nd level categories
					foreach ($lev1->getChildren() as $lev2):

						$category_is_visible = true;
						// only visible if online_from and online_to is ok
						if ($lev2->getValue('art_online_from') != '' && $lev2->getValue('art_online_from') > time()) { $category_is_visible = false; }

						if ($lev2->getValue('art_online_to') != '' && $lev2->getValue('art_online_to') < time()) { $category_is_visible = false; }


						if ($lev2->isOnline(true) && $category_is_visible == true) {

							if ($lev2->getId() == $path2) {
								$nav_main .= '
								<li class="dropdown-toggle active"><a href="'.$lev2->getUrl().'">'.htmlspecialchars($lev2->getValue('name')).'</a></li>';
							} else {
								$nav_main .= '
								<li class="dropdown-toggle"><a href="'.$lev2->getUrl().'">'.htmlspecialchars($lev2->getValue('name')).'</a></li>';
							}
						}
					endforeach;

				$nav_main .= '
				</ul>';

			}

		$nav_main .= '
		</li>';
	}
}

echo '
<div class="navbar-collapse collapse navbar-right">
	<ul class="nav navbar-nav">
		'.$nav_main.'
		'.rex::getProperty('lang_switch').'
	</ul>
</div><!--/.nav-collapse -->';
?>

		<!--/Navigation -->

	</div><!--/.nav-collapse -->
  </div>
</div>

<!-- Headerpic Anfang -->
<?php
// Include Headerpicture recursive
// If current article has no picture, take picture from parent categories
$header = '';
$headerpic = $this->getValue('art_file');
$darken = $this->getValue('art_darken');

if ($headerpic == '') {
    $category = rex_article::getCurrent()->getCategory();
    while ($headerpic == '') {
        if ($category == null) {
            break;
        }
        $headerpic = $category->getValue('art_file');
        $darken = $category->getValue('art_darken');
        $category = $category->getParent();
    }
}

if ($headerpic == '') {
    $headerpic = rex_article::getSiteStartArticle()->getValue('art_file');
    $darken = rex_article::getSiteStartArticle()->getValue('art_file_darken');
}


$header = '
<div id="headerpic" style="background-image: url('.rex_url::frontendController(['rex_media_type' => 'fullscreen', 'rex_media_file' => $headerpic]).');">';

    // Darken header picture
    if ($darken == '')  $darken = '0.35'; // Default darken 35%
    $header .= '
    <div class="layer" style="opacity: '.$darken.';"></div>';

    $header .= '
    <div class="container centered">
        <div class="row">
            <h3>'.$this->getValue('name').'</h3>
        </div><!-- /row -->
    </div> <!-- /container -->
</div><!-- /headerpic -->';



// If gallery exists,
// show gallery instead of header picture
if ($this->getValue('art_gallery') != '') {

    $header = '
    <section class="hero-slider slider-fullscreen">
        <ul class="slides">';
        
            $imagelist = explode(',', $this->getValue('art_gallery'));
            foreach ($imagelist as $file) {
            
                $media = rex_media::get($file);
                if ($media) {
                
                    $languageSuffix = '';
                    if (rex_clang::getCurrentId() == 2) {
                        $languageSuffix = '_en';
                    }

                    $mediadesc = str_replace(array("\r\n", "\n", "\r"), ' ', $media->getValue('med_description' . $languageSuffix));
					// english
					$mediatitle = $media->getValue('med_gallery_title' . $languageSuffix);
                    $mediatext = $media->getValue('med_gallery_text' . $languageSuffix);
                    $medialinktext = $media->getValue('med_gallery_link_text' . $languageSuffix);
					$medialink = $media->getValue('med_gallery_link');
					$mediadarken = $media->getValue('med_darken');

                    $header .= '
                    <li class="parallax kenburns">';
                        
                        // Abdunkelung
                        if ($mediadarken == '') $mediadarken = '0.35'; // Default darken 35%
                        $header .= '
                        <div class="overlay" style="opacity: '.$mediadarken.';"></div>';

                        $header .= '
                        <img alt="'.$mediatitle.'" class="background-image" src="'.rex_url::frontendController(['rex_media_type' => 'fullscreen', 'rex_media_file' => $file]).'">';


                        if ($mediatitle != '' || $mediatext != '') {
                            $header .= '
                            <div class="row slide-content animate">
                                <div class="col-lg-6 col-lg-offset-3 text-center">';

                                    if ($mediatitle != '') {
                                        $header .= '
                                        <h1>'.$mediatitle.'</h1>';
                                    }
                                    if ($mediatitle != '') {
                                        $header .= '
                                        <p class="lead">'.$mediatext.'</p>';
                                    }
                                    if ($medialink != '' && $medialinktext != '') {
                                        $header .= '
                                        <a href="'.$medialink.'" class="btn btn-theme">'.$medialinktext.'</a>';
                                    }

                                    $header .= '
                                </div>
                            </div>';
                        }

                    $header .= '
                    </li>';
                }
            }
        
        $header .= '
        </ul>
    </section><!--end of fullscreen slider-->';
}

echo $header;
?>
<!-- Headerpic Ende -->

<?php
// Breadcrumb
$path = explode("|",$this->getValue("path").$this->getValue("article_id")."|");
$secondLevel = $path[2];

if ($secondLevel != '') { // show breadcrumb only in second level or deeper
	echo '<div class="container breadcrumb-wrapper">';
		echo 'Du bist hier: ';
		$startArticle = rex_article::get(rex_article::getSiteStartArticleId());
		$startArticleUrl = $startArticle->getUrl();
		$startArticleName = $startArticle->getName();
		echo '<a href="'.$startArticleUrl.'"><span class="home_link">'.$startArticleName.'</a></span>';

		$nav = rex_navigation::factory();
		echo $nav->showBreadcrumb('', true);
	echo '</div>';
}

/*
If "01 . Standard", content-container has full width
*/
if (SITE_TYPE == 'col1') { ?>
	<article class="mtb">
		<?php echo $this->getArticle('1'); ?>
	</article>
<?php }

/*
If "02 . Zweispalter", there is a main column and a side column with 2/3 - 1/3 width
*/
if (SITE_TYPE == 'col2') { ?>
	<div class="container mtb">
		<div class="row">

			<div class="col-lg-8 col-sm-12">
				<?php echo $this->getArticle('1'); ?>
			</div>

			<div class="col-lg-3 col-lg-offset-1 sidebar hidden-xs hidden-sm">
				<!-- Subnavigation -->
<?php
$path = explode("|",$this->getValue("path").$this->getValue("article_id")."|");
$path1 = ((!empty($path[1])) ? $path[1] : '');
$path2 = ((!empty($path[2])) ? $path[2] : '');

$article = rex_article::get($path1);
$articleUrl = $article->getUrl();
$articleName = $article->getName();

$nav = rex_navigation::factory();
$subnav = $nav->get($path1,2,TRUE,TRUE);

if ($subnav != '') {

	echo '
	<h4 id="sidenav_title"><a href="'.$articleUrl.'">'.$articleName.'</a></h4>
	<div class="hline"></div>';

	echo $subnav;

}
?>
				<!-- /Subnavigation -->

				<!-- more Content -->
				<?php echo $this->getArticle('2'); ?>
			</div>

		</div>
	</div>
<?php } ?>

<!-- *******************************************************
 FOOTER
 ******************************************************* -->
 <div id="footerwrap">
	<div class="container">
		<div class="row">
			<div class="col-md-12">

			REX_ARTICLE[id=6]
			<?php
			// Include content of article 6. You can do it this way too:
			// $footer = new rex_article_content(6);
			// echo $footer->getArticle('1');
			?>

			</div><! --/col -->
		</div><! --/row -->
	</div><! --/container -->
 </div><! --/footerwrap -->

<div style="display:none;">REDAXO 5 rocks!</div>

<!-- Javascripts -->
<script type="text/javascript" src="<?= rex_url::base('resources/js/jquery.min.js') ?>"></script>
<script type="text/javascript" src="<?= rex_url::base('resources/js/bootstrap.min.js') ?>"></script>
<script type="text/javascript" src="<?= rex_url::base('resources/js/jquery.hoverex.min.js') ?>"></script>
<script type="text/javascript" src="<?= rex_url::base('resources/js/jquery.prettyPhoto.js') ?>"></script>
<script type="text/javascript" src="<?= rex_url::base('resources/js/jquery.flexslider-min.js') ?>"></script>
<script type="text/javascript" src="<?= rex_url::base('resources/js/prettify.js') ?>"></script>
<script type="text/javascript" src="<?= rex_url::base('resources/js/redaxo-demo.js') ?>"></script>

</body>
</html>
Code meines Test-Templates:

Code: Alles auswählen

<?php
define('SITE_TYPE', 'col1');

// URL-Rewrite-Anweisungen:
      $seo = new rex_yrewrite_seo();
      echo $seo->getTitleTag().PHP_EOL;
      echo $seo->getDescriptionTag().PHP_EOL;
      echo $seo->getRobotsTag().PHP_EOL;
      echo $seo->getHreflangTags().PHP_EOL;
      echo $seo->getCanonicalUrlTag().PHP_EOL;

// error_reporting(0);
error_reporting(E_ALL);
// Error report should only be active during development. Deavtivate (0) on a live website

$page_is_visible = true;

// Is current article offline?
if (rex_article::getCurrent()->isOnline() == 0) {
	$page_is_visible = false;
}

// is online_from_date newer than actual date?
if (rex_article::getCurrent()->getValue('art_online_from') != '' && rex_article::getCurrent()->getValue('art_online_from') > time()) {
	$page_is_visible = false;
}

// is online_from_date older than actual date
if (rex_article::getCurrent()->getValue('art_online_to') != '' && rex_article::getCurrent()->getValue('art_online_to') < time()) {
	$page_is_visible = false;
}


// Is User not logged in?
if (!rex_backend_login::hasSession()) {
	if ($page_is_visible == false) {
		// redirect to 404 page
		header ('HTTP/1.1 301 Moved Permanently');
		header('Location: '.rex_getUrl(rex_article::getNotFoundArticleId(), rex_clang::getCurrentId()));
		exit();
	}
}

// Necessary for input and output of module "Tabs und Akkordions"
rex::setProperty('tabs', new ArrayIterator());

// set charset to utf8
header('Content-Type: text/html; charset=utf-8');

// setLocale is a language meta field, set your individual locale informations per language
setlocale (LC_ALL, rex_clang::getCurrent()->getValue('clang_setlocale'));

?><!DOCTYPE html>
<html lang="<?php echo rex_clang::getCurrent()->getCode(); ?>">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<?php
	// Use article title as title-Tag, unless a custom title-tag is set
    if ($this->hasValue("art_title") && $this->getValue("art_title") != "") {
		$title = htmlspecialchars($this->getValue('art_title'));
	} else {
		$title = htmlspecialchars($this->getValue('name'));
	}

	echo '
	<title>'.$title.'</title>';

	// Keywords and description
	// If current article does not have keywords and description, take them from start article
	$keywords = "";
    if ($this->hasValue("art_keywords") && $this->getValue("art_keywords") != "") {
        $keywords = $this->getValue("art_keywords");
    } else {
        $home = new rex_article_content(rex_article::getSiteStartArticleId());
        if ($home->hasValue("art_keywords")) {
            $keywords = $home->getValue('art_keywords');
        }
    }

    $description = "";
    if ($this->hasValue("art_description") && $this->getValue("art_description") != "") {
        $description = $this->getValue("art_description");
    } else {
        $home = new rex_article_content(rex_article::getSiteStartArticleId());
        if ($home->hasValue("art_description")) {
            $description = $home->getValue('art_description');
        }
    }

	echo '
	<meta name="keywords" content="'.htmlspecialchars($keywords).'">';

	echo '
	<meta name="description" content="'.htmlspecialchars($description).'">';
	?>
                <link rel="icon" type="image/png" sizes="32x32" href="<?= rex_url::base('resources/favicons/favicon-32x32.png') ?>">
                <link rel="icon" type="image/png" sizes="16x16" href="<?= rex_url::base('resources/favicons/favicon-16x16.png') ?>">

<!-- Hier die benötigten CSS-Stylesheets einbinden: -->
		<link rel="stylesheet" type="text/css" href="files/styles.css" media="screen">
		<style type="text/css"><!--
			@import "files/styles.css";
			@import "files/theme.css";
		--></style>

<!--[if lt IE 8]>
<style type="text/css" media="screen">
#menuh{float:none;}
body{behavior:url(files/csshover.htc); font-size:75%;}
#menuh ul li{float:left; width: 100%;}
#menuh a{height:1%;font:bold 1.1em/1.4em helvetica, arial, sans-serif;}
</style>
<![endif]-->

<!-- Ende Einbindung der CSS-Stylesheets -->

</head>

<body>
		<div id="pageWrapper">
			<div id="outerColumnContainer">
				<div id="innerColumnContainer">
					<div id="middleColumn">
						<div id="masthead" class="inside">

<!--
<h1>Ideen <i>effektvoll</i> montiert !</h1>
-->
<h2>Montagebau Andreas Greif</h2>
							<hr class="hide">
						</div>
						<div id="content">
<!-- <h3 class="pageTitle">Montagebau Andreas Greif .:. Ayl</h3> -->
							<div id="contentColumnContainer">
								<div id="innerContent">
									<div class="inside">
			<?php // echo $this->getArticle(1); ?>
			<?php echo $this->getArticle('1'); ?>
									</div>
									<hr class="hide">
								</div>

								<div class="clear"></div>
							</div>
						</div>
					</div>

					<div id="leftColumn">
						<div class="inside">

<div id="cornerLogo">
	<div class="placeHolder">
		<p>
			&nbsp;
		</p>
	</div>
</div>

<div class="leftBlock">
	<h3>Navigation</h3>
	<div class="vnav">
<ul>
<li><a href="/">Startseite</a></li>

<!-- Hier der Navigationsmenü-Code rein: -->
<!-- Navigation Anfang aus Rex 5.x -->
<!-- Sprachwechsler Anfang -->
<?php
// uncomment to show language array
// print_r(rex_clang::getAll());

$current_language = '';
$languages = '';


// two languages online -> only show link to other language
if (count(rex_clang::getAll(true)) == 2) {

	foreach (rex_clang::getAll(true) as $lang) {
		if (rex_clang::getCurrentId() != $lang->getValue('id')) {
			$languages = '
			<li class="lang-title visible-xs">{{ languages }}</li>
			<li class="lang">
				<a href="'.rex_getUrl($this->getValue('article_id'), $lang->getValue('id')).'" title="'.$lang->getValue('name').'">
					<span class="hidden-xs">'.$lang->getValue('code').'</span>
					<span class="visible-xs">'.$lang->getValue('name').'</span>
				</a>
			</li>';
		}
	}

	rex::setProperty('lang_switch', $languages);

// more than two languages online -> show dropdown, current language not clickable
} elseif (count(rex_clang::getAll(true)) > 2) {
	
	foreach (rex_clang::getAll(true) as $lang) {
		if (rex_clang::getCurrentId() == $lang->getValue('id')) {
			$current_language .= '
			<a href="#" title="'.$lang->getValue('name').'">
				<span class="hidden-xs">'.$lang->getValue('code').'</span>
				<span class="visible-xs">'.$lang->getValue('name').'</span>
			</a>';
		} else {
			$languages .= '
			<li class="dropdown-toggle">
				<a href="'.rex_getUrl($this->getValue('article_id'), $lang->getValue('id')).'" title="'.$lang->getValue('name').'">
					<span class="hidden-xs">'.$lang->getValue('code').'</span>
					<span class="visible-xs">'.$lang->getValue('name').'</span>
				</a>
			</li>';
		}
	}

	rex::setProperty('lang_switch', '<li class="lang-title visible-xs">{{ languages }}</li><li class="dropdown-toggle lang">' . $current_language . '<ul class="dropdown-menu">' . $languages . '</ul></li>');

}
?>
<!-- Sprachwechsler Ende -->
<?php
$path = explode("|",$this->getValue("path").$this->getValue("article_id")."|");
$path1 = ((!empty($path[1])) ? $path[1] : '');
$path2 = ((!empty($path[2])) ? $path[2] : '');

$nav_main = '';

foreach (rex_category::getRootCategories() as $lev1) {

	$hidden_ids = array(1,6);
	// hide Home- and footer-article in navigation

	$category_is_visible = true;
	// only visible if online_from and online_to is ok
	if ($lev1->getValue('art_online_from') != '' && $lev1->getValue('art_online_from') > time()) { $category_is_visible = false; }

	if ($lev1->getValue('art_online_to') != '' && $lev1->getValue('art_online_to') < time()) { $category_is_visible = false; }


	if ($lev1->isOnline(true) && (!in_array($lev1->getId(), $hidden_ids)) && $category_is_visible == true) {

		if ($lev1->getId() == $path1) {
			$nav_main .= '
			<li class="dropdown-toggle active"><a href="'.$lev1->getUrl().'">'.htmlspecialchars($lev1->getValue('name')).'</a>';
		} else {
   			$nav_main .= '
			<li class="dropdown-toggle"><a href="'.$lev1->getUrl().'">'.htmlspecialchars($lev1->getValue('name')).'</a>';
		}

		// 1st level start
		$lev1Size = sizeof($lev1->getChildren());

			if ($lev1Size != "0") {

//				$nav_main .= '<ul class="dropdown-menu">';

					// START 2nd level categories
					foreach ($lev1->getChildren() as $lev2):

						$category_is_visible = true;
						// only visible if online_from and online_to is ok
						if ($lev2->getValue('art_online_from') != '' && $lev2->getValue('art_online_from') > time()) { $category_is_visible = false; }

						if ($lev2->getValue('art_online_to') != '' && $lev2->getValue('art_online_to') < time()) { $category_is_visible = false; }


						if ($lev2->isOnline(true) && $category_is_visible == true) {

							if ($lev2->getId() == $path2) {
								$nav_main .= '
								<li class="dropdown-toggle active"><a href="'.$lev2->getUrl().'">'.htmlspecialchars($lev2->getValue('name')).'</a></li>';
							} else {
								$nav_main .= '
								<li class="dropdown-toggle"><a href="'.$lev2->getUrl().'">'.htmlspecialchars($lev2->getValue('name')).'</a></li>';
							}
						}
					endforeach;

//				$nav_main .= '</ul>';


			}

		$nav_main .= '
		</li>';
	}
}

echo '
<div class="navbar-collapse collapse navbar-right">
<!--	<ul class="nav navbar-nav"> -->
		'.$nav_main.'
		'.rex::getProperty('lang_switch').'
<!-- 	</ul> -->
</div><!--/.nav-collapse -->';
?>

		<!--/Navigation -->
<!-- Ende Navigationsmenü-Code aus Rex 5.x -->

</ul>
	</div>

</div>

<div class="leftBlock leftTextBlock">
	<p>
		<b>Qualit&auml;t, die l&auml;nger lebt -<br>Montagebau Andreas Greif</b>
	</p>
</div>
							<hr class="hide">
						</div>
					</div>

					<div id="footer">
<p class="footer">
Alle Inhalte &copy; <a href="/">Montagebau Andreas Greif, Ayl b. Saarburg</a> | Website: <a href="http://www.webtronics.it" target="_blank">webtronics.IT PC Service</a>
<br />
Alle Marken und Warenzeichen sind Eigentum der jeweiligen Besitzer und dienen nur der Darstellung / Beschreibung.
</p>

						<hr class="hide">
					</div>
					<div class="clear"></div>
				</div>
			</div>
		</div>
	</body>
</html>
Oder gibt es vielleicht sogar eine viel einfachere Möglichkeit, von 3.x / 4.x auf 5.6.4 zu migrieren?

Benutzeravatar
Peter.Bickel
Beiträge: 1855
Registriert: 25. Jan 2005, 21:17
Wohnort: Schleswig-Holstein
Kontaktdaten: Website

Re: Gallery Modul in eigenes Template einbinden

6. Nov 2018, 10:17

Das Modul allein gibt Dur nur die Bilder aus.
Damit das so ähnlich aussieht wie in der Demo, müsstest Du auch noch die Formatierungen aus der CSS übernehmen.
Und damit sich die Bilder in der Lightbox vergrößern, brauchst Du auch das dazu passende Javascript aus der Demo.

Lg, Peter.

Zurück zu „Module/Aktionen [R5]“