blog.exotec

TYPO3 . XHTML/CSS . JavaScript/AJAX . iPhone/iOS

Archive for November, 2016

Extbase Plain SQL Abfrage

Samstag, November 5th, 2016

$sql = "SELECT * FROM table WHERE hidden=0 AND deleted=0";
$query->statement($sql);
// set true for array
return $query->execute(true);

Mit Extbase Pages Media Resources auslesen

Samstag, November 5th, 2016

Im Controller oder Repository:

public function findFileFromPageMedia( $pid ){
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$fileRepository = $objectManager->get('TYPO3\CMS\Core\Resource\FileRepository');
$fileObjects = $fileRepository->findByRelation('pages', 'media', $pid);
// gibt Image Object Information
$files = array();
foreach ($fileObjects as $key => $value) {
$files[$key]['reference'] = $value->getReferenceProperties();
$files[$key]['original'] = $value->getOriginalFile()->getProperties();
}
return $files;
}

Fluid Template:

<f :image src="{result.image.0.reference.uid}" alt="" width="70c" height="70c" treatIdAsReference="1" />

Mit Extbase die Tabelle Pages erweitern

Samstag, November 5th, 2016

extTables.sql

#
# Modifying pages table
#
CREATE TABLE pages (
check_in_out varchar(255) DEFAULT '' NOT NULL,
price varchar(255) DEFAULT '' NOT NULL,
persons int(11) unsigned DEFAULT '0' NOT NULL,
disabled_access tinyint(4) unsigned DEFAULT '0' NOT NULL,
children tinyint(4) unsigned DEFAULT '0' NOT NULL,
use_as_room tinyint(4) unsigned DEFAULT '0' NOT NULL,
dinner tinyint(4) unsigned DEFAULT '0' NOT NULL,
breakfast tinyint(4) unsigned DEFAULT '0' NOT NULL,
);

Configuration/TCA/Overrides/pages.php

< ?php
if (!defined('TYPO3_MODE')) {
die ('Access denied.');
}
// Configure new fields:
$fields = array(
'check_in_out' => array(
‘label’ => ‘Buchungen’,
‘exclude’ => 1,
‘config’ => array(
‘type’ => ‘inline’,
‘foreign_table’ => ‘tx_accomodation_domain_model_dates’,
‘maxitems’ => 999,
‘appearance’ => array(
‘collapseAll’ => 1,
‘expandSingle’ => 1,
),
),
),
‘price’ => array(
‘exclude’ => 1,
‘label’ => ‘Preis’,
‘config’ => array(
‘type’ => ‘input’,
‘default’ => 0,
‘eval’ => ‘double2′
)
),
‘persons’ => array(
‘exclude’ => 1,
‘label’ => ‘Anzahl Personen’,
‘config’ => array(
‘type’ => ‘input’,
‘default’ => 0
)
),
‘children’ => array(
‘exclude’ => 1,
‘label’ => ‘Kinder’,
‘config’ => array(
‘type’ => ‘check’,
‘default’ => 0
)
),
‘disabled_access’ => array(
‘exclude’ => 1,
‘label’ => ‘Behindertengerecht’,
‘config’ => array(
‘type’ => ‘check’,
‘default’ => 0
)
),
‘use_as_room’ => array(
‘exclude’ => 1,
‘label’ => ‘Seite als Zimmer verwenden?’,
‘config’ => array(
‘type’ => ‘check’,
‘default’ => 0
)
),
‘breakfast’ => array(
‘exclude’ => 1,
‘label’ => ‘Frühstück’,
‘config’ => array(
‘type’ => ‘check’,
‘default’ => 0
)
),
‘dinner’ => array(
‘exclude’ => 1,
‘label’ => ‘Abendbrot’,
‘config’ => array(
‘type’ => ‘check’,
‘default’ => 0
)
),
);
// Add new fields to pages:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(’pages’, $fields);
// Make fields visible in the TCEforms:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
‘pages’, // Table name
‘–div–;Buchungskalender;accomodation’, // Field list to add
”, // List of specific types to add the field list to. (If empty, all type entries are affected)
” // Insert fields before (default) or after one, or replace a field
);
// Add the new palette:
$GLOBALS[’TCA’][’pages’][’palettes’][’accomodation’] = array(
’showitem’ => ‘use_as_room,–linebreak–,check_in_out,–linebreak–,price,persons,–linebreak–,disabled_access,children,dinner,breakfast,’
);


87,777 Spam-Kommentare
blockiert von
Akismet