나는 tiny_mce의 image_list_url을 PHP 파일로 변경하려고합니다.JS로 PHP 파일을 포함
URL을 image_list.php 파일로 변경했습니다. js 파일과 동일한 정확한 출력 텍스트를 생성합니다.
동일한 출력을 한 후에도 이미지 목록이 표시되지 않습니다.
콘텐츠 유형이 영향을 주는지 궁금합니다.
내 JS 파일의 콘텐츠는:
// This list may be created by a server logic page PHP/ASP/ASPX/JSP in some backend system.
// There images will be displayed as a dropdown in all image dialogs if the "external_link_image_url"
// option is defined in TinyMCE init.
var tinyMCEImageList = new Array(
// Name, URL
["Logo 1", "media/logo.jpg"],
["Logo 2 Over", "media/logo_over.jpg"]
);
은 내 PHP 코드 :
<?php
require('../../../system/config.php');
$strPath = APP_ROOT.DS.'sys_uploads/images/';
$objFileList = dir($strPath);
$arrFileList = array();
while (false !== ($entry = $objFileList->read())) {
if(is_file($strPath.$entry))
$arrFileList[] = array($entry, ABS_URL.'/sys_uploads/images/'.$entry);
}
$objFileList->close();
header('Content-type: application/x-javascript');
//header('Content-type: text');
?>
// This list may be created by a server logic page PHP/ASP/ASPX/JSP in some backend system.
// There images will be displayed as a dropdown in all image dialogs if the "external_link_image_url"
// option is defined in TinyMCE init.
var tinyMCEImageList = new Array(
// Name, URL
<?php
if(count($arrFileList)>0)
foreach($arrFileList as $dataRow):
?>
["<?php echo $dataRow[0];?>", "<?php echo $dataRow[1];?>"],
<?php endforeach; ?>
);
은 내 PHP 출력은 :
는// This list may be created by a server logic page PHP/ASP/ASPX/JSP in some backend system.
// There images will be displayed as a dropdown in all image dialogs if the "external_link_image_url"
// option is defined in TinyMCE init.
alert('test working or not');
var tinyMCEImageList = new Array(
// Name, URL
["Logo 1", "media/logo.jpg"],
["Logo 2 Over", "media/logo_over.jpg"]
);
편집 :
제안에 따라 경찰 난 추가 너무 전야의 팝업 메시지 n은 나타나지 않았다.
해결책 :
던 내 코드에 오류가 있었지만 링크에서 좋은 해결책을 찾을 알고 제안 다음은 .js와 PHP 파일 출력이 모두 동일로
http://tinymce.moxiecode.com/wiki.php/Configuration%3aexternal_image_list_url
왜'$ arrFileList'의 크기를 계산합니까? 그것이 배열 인 한'foreach '에는 필요하지 않습니다. – Htbaa
나는 그 빈 ... 제안을위한 thnx ... 내 코드를 최적화하는 데 도움이 건너 뛰고 싶습니다 – KoolKabin