1
我已經配置了我的xml,controller,model。 但我有問題與視圖和phtml文件。 請告訴我如何配置我的視圖和phtml文件來顯示圖像。如何配置視圖和phtml文件以在圖庫中顯示圖像?
這裏的控制器和模型的代碼
型號:
public function getImageUploadPath() {
return Fox::getUploadDirectoryPath() . DIRECTORY_SEPARATOR . 'gallery' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR;
}
public function getImageUploadUrl() {
return Fox::getUploadDirectoryUrl() . '/' . 'gallery' . '/' . 'images' . '/';
}
public function getAllFolderImages() {
$dir = $this->getImageUploadPath();
$files=array();
$i=0;
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if((filetype($dir . $file)=='jpg')||(filetype($dir . $file)=='png')||(filetype($dir . $file)=='gif')||(filetype($dir . $file)=='jpeg')){
$files[$i]=$file;
$i++;
}
}
closedir($dh);
}
}
return $files;
}
控制器:
public function indexAction(){
$this->loadLayout();
$this->renderLayout();
}
public function getImagesAction(){
return Fox::getModel('gallery/images')->getAllFolderImages();
}
public function getImagePathAction(){
return Fox::getModel('gallery/images')->getImageUploadUrl();
}
請告訴我現在該怎麼配置視圖和PHTML文件。