Тема: TV, Link field
Показать сообщение отдельно
Старый 25.07.2006, 15:52   #2
Дмитрий Самойлов
Продвинутый
 
Регистрация: 28.03.2005
Сообщений: 78
Отправить сообщение для Дмитрий Самойлов с помощью ICQ Отправить сообщение для Дмитрий Самойлов с помощью Skype™
По умолчанию ошибка в темплаволе

Цитата:
Сообщение от Tod
...
И еще один вопрос. Или скорее замечание. Я задаю на корневой странице шаблон для подстраниц сайта. Все четко, а потом после добаления новой подстраницы захожу через модуль Web-TV-Page и там где должны отображаться элементы контента - их нет)) только после установки новой подстраницы непосредственно нужного шаблона, эти элементы виднЫ))
Это ошибка в темлаволе - нужно исправить в файле typo3conf\ext\templavoila\mod1\class.tx_templavoil a_mod1_wizards.php метод renderTemplateSelector

Вот правильный код
Цитата:
function renderTemplateSelector ($positionPid, $templateType='tmplobj') {
global $LANG, $TYPO3_DB;

$storageFolderPID = $this->apiObj->getStorageFolderPid($positionPid);
$tmplHTML = array();

switch ($templateType) {
case 'tmplobj':
// Create the "Default template" entry
$previewIconFilename = $GLOBALS['BACK_PATH'].'../'.t3lib_extMgm::siteRelPath($this->extKey).'res1/default_previewicon.gif';
$previewIcon = '<input type="image" class="c-inputButton" src="'.$previewIconFilename.'" title="" />';
$description = htmlspecialchars($LANG->getLL ('template_descriptiondefault'));
$tmplHTML [] = '<table style="float:left; width: 100%;" valign="top"><tr><td colspan="2" nowrap="nowrap">
<h3 class="bgColor3-20">'.htmlspecialchars($LANG->getLL ('template_titledefault')).'</h3></td></tr>
<tr><td valign="top">'.$previewIcon.'</td><td width="120" valign="top"><p>'.$description.'</p></td></tr></table>';

$tTO = 'tx_templavoila_tmplobj';
$tDS = 'tx_templavoila_datastructure';
$res = $TYPO3_DB->exec_SELECTquery (
"$tTO.*",
"$tTO LEFT JOIN $tDS ON $tTO.datastructure = $tDS.uid",
"$tTO.pid=".intval($storageFolderPID)." AND $tDS.scope=1".
t3lib_befunc::deleteClause ($tTO).t3lib_befunc::deleteClause ($tDS).
t3lib_BEfunc::versioningPlaceholderClause($tTO).t3 lib_BEfunc::versioningPlaceholderClause($tDS)
);

while (false !== ($row = $TYPO3_DB->sql_fetch_assoc($res))) {
// Check if preview icon exists, otherwise use default icon:
$tmpFilename = 'uploads/tx_templavoila/'.$row['previewicon'];
$previewIconFilename = (@is_file(PATH_site.$tmpFilename)) ? ($GLOBALS['BACK_PATH'].'../'.$tmpFilename) : ($GLOBALS['BACK_PATH'].'../'.t3lib_extMgm::siteRelPath($this->extKey).'res1/default_previewicon.gif');
$previewIcon = '<input type="image" class="c-inputButton" onclick="document.getElementById(\'datum\').value= '.$row['uid'].';" src="'.$previewIconFilename.'" title="" />';
$description = $row['description'] ? htmlspecialchars($row['description']) : $LANG->getLL ('template_nodescriptionavailable');
$tmplHTML [] = '<table style="width: 100%;" valign="top"><tr><td colspan="2" nowrap="nowrap"><h3 class="bgColor3-20">'.htmlspecialchars($row['title']).'</h3></td></tr>'.
'<tr><td valign="top">'.$previewIcon.'</td><td width="120" valign="top"><p>'.$description.'</p></td></tr></table>';
}
$tmplHTML [] = '<input type="hidden" value="0" name="data[tx_templavoila_to]" id="datum">';
break;

case 't3d':
if (t3lib_extMgm::isLoaded('impexp')) {

// Read template files from a certain folder. I suggest this is configurable in some way. But here it is hardcoded for initial tests.
$templateFolder = PATH_site.'fileadmin/export/templates/';
$files = t3lib_div::getFilesInDir($templateFolder,'t3d,xml' ,1,1);

// Traverse the files found:
foreach($files as $absPath) {
// Initialize the import object:
$import = $this->getImportObject();
if ($import->loadFile($absPath)) {
if (is_array($import->dat['header']['pagetree'])) { // This means there are pages in the file, we like that...:

// Page tree:
reset($import->dat['header']['pagetree']);
$pageTree = current($import->dat['header']['pagetree']);


// Thumbnail icon:
if (is_array($import->dat['header']['thumbnail'])) {
$pI = pathinfo($import->dat['header']['thumbnail']['filename']);
if (t3lib_div::inList('gif,jpg,png,jpeg',strtolower($ pI['extension']))) {

// Construct filename and write it:
$fileName = PATH_site.
'typo3temp/importthumb_'.t3lib_div::shortMD5($absPath).'.'.$p I['extension'];
t3lib_div::writeFile($fileName, $import->dat['header']['thumbnail']['content']);

// Check that the image really is an image and not a malicious PHP script...
if (getimagesize($fileName)) {
// Create icon tag:
$iconTag = '<img src="'.$this->doc->backPath.'../'.substr($fileName,strlen(PATH_site)).'" '.$import->dat['header']['thumbnail']['imgInfo'][3].' vspace="5" style="border: solid black 1px;" alt="" />';
} else {
t3lib_div::unlink_tempfile($fileName);
$iconTag = '';
}
}
}

$aTagB = '<a href="'.htmlspecialchars(t3lib_div::linkThisScript (array('templateFile' => $absPath))).'">';
$aTagE = '</a>';
$tmplHTML [] = '<table style="float:left; width: 100%;" valign="top"><tr><td colspan="2" nowrap="nowrap">
<h3 class="bgColor3-20">'.$aTagB.htmlspecialchars($import->dat['header']['meta']['title'] ? $import->dat['header']['meta']['title'] : basename($absPath)).$aTagE.'</h3></td></tr>
<tr><td valign="top">'.$aTagB.$iconTag.$aTagE.'</td><td valign="top"><p>'.htmlspecialchars($import->dat['header']['meta']['description']).'</p>
<em>Levels: '.(count($pageTree)>1 ? 'Deep structure' : 'Single page').'<br/>
File: '.basename($absPath).'</em></td></tr></table>';

}
}
}
}
break;

}

if (is_array($tmplHTML) && count($tmplHTML)) {
$counter = 0;
$content .= '<table>';
foreach ($tmplHTML as $single) {
$content .= ($counter ? '':'<tr>').'<td valign="top">'.$single.'</td>'.($counter ? '</tr>':'');
$counter ++;
if ($counter > 1) { $counter = 0; }
}
$content .= '</table>';
}

return $content;
}

Последний раз редактировалось Дмитрий Самойлов; 25.07.2006 в 15:54
Дмитрий Самойлов вне форума   Ответить с цитированием