Bildmodul erweitern/anpassen
Verfasst: Di 29. Okt 2013, 12:23
Hallo,
ich habe mich grad mal am 4.9. probiert und würde einfach gern in dem Bildmodul (Content_image) versucht und wollte gern eine 2. Ausgabe realisieren und danach halt nochn jQuery-Teaser draus bauen (aber das stell ich dann später mal vor)
Grundsätzlich gehts mir um die Ansprache des CMS über die Klassen und des Smarty.
Habe nun:
OUTPUT (hinzufügen eines 2.Bildes):
Das Smarty schaut so aus:
GET.TPL
So richtig gehts nicht, er spielt das 2. Bild nicht aus, bzw nicht den ImageEditor im Backend. Ich denke ich hab einfach nur etwas nicht beachtet. Kann jemand mal kurz draufschauen und sagen wo es hakt?
Vielen Dank und ich hoffe hier ein Modul bald einreichen zu können.
ich habe mich grad mal am 4.9. probiert und würde einfach gern in dem Bildmodul (Content_image) versucht und wollte gern eine 2. Ausgabe realisieren und danach halt nochn jQuery-Teaser draus bauen (aber das stell ich dann später mal vor)
Grundsätzlich gehts mir um die Ansprache des CMS über die Klassen und des Smarty.
Habe nun:
OUTPUT (hinzufügen eines 2.Bildes):
Code: Alles auswählen
<?php
#…REG-INFOS von * @author marcus.gnass@4fb.de
- gekürzt für Übersicht#
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
// Get Images (2x) -Source and Desc
$imageSource = "CMS_IMG[1]";
$imageSource1 = "CMS_IMG[2]";
$imageDescription = "CMS_IMGDESCR[1]";
$imageDescription1 = "CMS_IMGDESCR[2]";
// get editor as content type IMGEDITOR
if (cRegistry::isBackendEditMode()) {
$imageEditor = "CMS_IMGEDITOR[1]";
$imageEditor2 = "CMS_IMGEDITOR[2]";
}
if ( (0 < strlen($imageSource)) OR (0 < strlen($imageSource1)) ){
$clientConfig = cRegistry::getClientConfig(cRegistry::getClientId());
}
// build class containing all data necessary to display image & register image-dimensions
if (0 < strlen($imageSource)) {
$filename = str_replace($clientConfig["upl"]["htmlpath"], $clientConfig["upl"]["path"], $imageSource);
list($imageWidth, $imageHeight) = getimagesize($filename);
$image = new stdClass();
$image->src = $imageSource;
$image->alt = $imageDescription;
$image->width = $imageWidth;
$image->height = $imageHeight;
} else {
$image = NULL;
}
if (0 < strlen($imageSource1)) {
$filename1 = str_replace($clientConfig["upl"]["htmlpath"], $clientConfig["upl"]["path"], $imageSource1);
list($imageWidth1, $imageHeight1) = getimagesize($filename1);
$image1 = new stdClass();
$image1->src = $imageSource1;
$image1->alt = $imageDescription1;
$image1->width = $imageWidth1;
$image1->height = $imageHeight1;
} else {
$image1 = NULL;
}
if (cRegistry::isBackendEditMode()) {
$label = mi18n("LABEL_IMAGE");
} else {
$label = NULL;
}
// use smarty template to output header text
$tpl = cSmartyFrontend::getInstance();
$tpl->assign('label', $label);
$tpl->assign('editor', $imageEditor);
$tpl->assign('image', $image);
$tpl->assign('editor1', $imageEditor1);
$tpl->assign('image1', $image1);
$tpl->display('get.tpl');
?>
GET.TPL
Code: Alles auswählen
<!-- content_image -->
{if 0 lt $label|strlen}
<label class="content_type_label">{$label}</label>
{/if}
{$editor}
{if NULL neq $image}
<img src="{$image->src}" alt="{$image->alt}" width="{$image->width}" height="{$image->height}" />
{/if}
{$editor1}
{if NULL neq $image1}
<img src="{$image1->src}" alt="{$image1->alt}" width="{$image1->width}" height="{$image1->height}" />
{/if}
<!-- /content_image -->
Vielen Dank und ich hoffe hier ein Modul bald einreichen zu können.