Fehlersuche bei Pagination

hups1803

Erfahrenes Mitglied
Hallo,

ich möchte eine php die im Original echo anweisung hat in ein cms Integrieren,

und muss deshalb das echo mit $text ersetzten da das $text vom cms gerendert wird .


Nun habe ich aber auf der Paginations php immer eine fehlermeldung und ich finde den fehler nicht.

hier mal meine php mit $text der fehler kommt bei zeile 57

Code:
<?php 

	if(!isset($manager))
	{
		/**
		 *  this is part of  script for processing file paste 
		 */
		//$_GET = $_POST;
		include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
		include_once(CLASS_PAGINATION);
		$pagination = new pagination(false);
		if(!empty($_GET['search']))
		{
			include_once(CLASS_SEARCH);
			
			$search  = new Search($_GET['search_folder']);
			$search->addSearchKeyword('recursive', @$_GET['search_recursively']);
			$search->addSearchKeyword('mtime_from', @$_GET['search_mtime_from']);
			$search->addSearchKeyword('mtime_to', @$_GET['search_mtime_to']);
			$search->addSearchKeyword('size_from', @$_GET['search_size_from']);
			$search->addSearchKeyword('size_to', @$_GET['search_size_to']);
			$search->addSearchKeyword('recursive', @$_GET['search_recursively']);
			$search->addSearchKeyword('name', @$_GET['search_name']);
			$search->doSearch();
			$fileList = $search->getFoundFiles();
			$folderInfo = $search->getRootFolderInfo();			
			
		}else 
		{
			include_once(CLASS_MANAGER);
			include_once(CLASS_SESSION_ACTION);
			$sessionAction = new SessionAction();
			include_once(DIR_AJAX_INC . "class.manager.php");
		
			$manager = new manager();
			$manager->setSessionAction($sessionAction);
		
			$fileList = $manager->getFileList();
			$folderInfo = $manager->getFolderInfo();	
						
		}
		$pagination->setUrl(CONFIG_URL_FILEnIMAGE_MANAGER);	

	}else 
	{
		include_once(CLASS_PAGINATION);
		$pagination = new pagination(false);			
	}

		
		$pagination->setTotal(sizeof($fileList));
		$pagination->setFirstText(PAGINATION_FIRST);
		$pagination->setPreviousText(PAGINATION_PREVIOUS);
		$pagination->setNextText(PAGINATION_NEXT);
		$pagination->setLastText(PAGINATION_LAST);
		$pagination->setLimit(!empty($_GET['limit'])?intval($_GET['limit']):CONFIG_DEFAULT_PAGINATION_LIMIT);
		$text .= $pagination->getPaginationHTML();
		$text .= "<script type=\"text/javascript\">";
		
        $text .= "parentFolder = {path:'" . getParentFolderPath($folderInfo['path']). "'};"; 
		$text .= 'currentFolder ={'; 
		$count =1;
		foreach($folderInfo as $k=>$v)
		{
			$text .= ($count++ == 1?'':',') . "'" . $k . "':'" . ($k=='ctime'|| $k=='mtime'?date(DATE_TIME_FORMAT, $v):$v)  . "'";

		}
		$text .= "};";
		$fileList = array_slice($fileList, $pagination->getPageOffset(), $pagination->getLimit());
		$text .= 'numRows = ' . sizeof($fileList) . ";";
		$text .= "files = {";
		$count = 1;
		
		
		foreach($fileList as $file)
		{
			$text .= (($count > 1)?",":'').$count++ . ":{";
			$j = 1;
			foreach($file as $k=>$v)
			{
				
				if($k  == 'ctime' || $k == 'mtime')
				{
					$v = @date(DATE_TIME_FORMAT, $v);
				}	
				if($k == 'size')
				{
					$v = transformFileSize($v);
				}
				$text .= (($j++ > 1)?",":'') . "'" . $k . "':'" . $v . "'";
			}
			$text .= (($j++ > 1)?",":'') . "'url':'" . getFileUrl($file['path']) . "'";
			$text .= "}";				
		}
		$text .=  "};</script>";
	if(!empty($_GET['view']))
	{
		switch($_GET['view'])
		{
			case 'detail':
			case 'thumbnail':
			case 'text':	
				$view = $_GET['view'];
				break;
			default:
				$view = CONFIG_DEFAULT_VIEW;
		}
	}else 
	{
		$view = CONFIG_DEFAULT_VIEW;
	}	
	switch($view)
	{
		case 'text':
			//list file name only
			include_once(DIR_AJAX_ROOT . '_ajax_get_text_listing.php');
			break;
		case 'thumbnail':
			//list file with thumbnail
			include_once(DIR_AJAX_ROOT . '_ajax_get_thumbnail_listing.php');
			break;
		case 'detail':
		default:
			include_once(DIR_AJAX_ROOT . '_ajax_get_details_listing.php');
	}

	

?>


das original sieht so aus

Code:
<?php 

	if(!isset($manager))
	{
		/**
		 *  this is part of  script for processing file paste 
		 */
		//$_GET = $_POST;
		include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
		include_once(CLASS_PAGINATION);
		$pagination = new pagination(false);
		if(!empty($_GET['search']))
		{
			include_once(CLASS_SEARCH);
			
			$search  = new Search($_GET['search_folder']);
			$search->addSearchKeyword('recursive', @$_GET['search_recursively']);
			$search->addSearchKeyword('mtime_from', @$_GET['search_mtime_from']);
			$search->addSearchKeyword('mtime_to', @$_GET['search_mtime_to']);
			$search->addSearchKeyword('size_from', @$_GET['search_size_from']);
			$search->addSearchKeyword('size_to', @$_GET['search_size_to']);
			$search->addSearchKeyword('recursive', @$_GET['search_recursively']);
			$search->addSearchKeyword('name', @$_GET['search_name']);
			$search->doSearch();
			$fileList = $search->getFoundFiles();
			$folderInfo = $search->getRootFolderInfo();			
			
		}else 
		{
			include_once(CLASS_MANAGER);
			include_once(CLASS_SESSION_ACTION);
			$sessionAction = new SessionAction();
			include_once(DIR_AJAX_INC . "class.manager.php");
		
			$manager = new manager();
			$manager->setSessionAction($sessionAction);
		
			$fileList = $manager->getFileList();
			$folderInfo = $manager->getFolderInfo();	
						
		}
		$pagination->setUrl(CONFIG_URL_FILEnIMAGE_MANAGER);	

	}else 
	{
		include_once(CLASS_PAGINATION);
		$pagination = new pagination(false);			
	}

		
		$pagination->setTotal(sizeof($fileList));
		$pagination->setFirstText(PAGINATION_FIRST);
		$pagination->setPreviousText(PAGINATION_PREVIOUS);
		$pagination->setNextText(PAGINATION_NEXT);
		$pagination->setLastText(PAGINATION_LAST);
		$pagination->setLimit(!empty($_GET['limit'])?intval($_GET['limit']):CONFIG_DEFAULT_PAGINATION_LIMIT);
		echo $pagination->getPaginationHTML();
		echo "<script type=\"text/javascript\">\n";
		
        echo "parentFolder = {path:'" . getParentFolderPath($folderInfo['path']). "'};\n"; 
		echo 'currentFolder ={'; 
		$count =1;
		foreach($folderInfo as $k=>$v)
		{
			echo ($count++ == 1?'':',') . "'" . $k . "':'" . ($k=='ctime'|| $k=='mtime'?date(DATE_TIME_FORMAT, $v):$v)  . "'";

		}
		echo "};\n";
		$fileList = array_slice($fileList, $pagination->getPageOffset(), $pagination->getLimit());
		echo 'numRows = ' . sizeof($fileList) . ";\n";
		echo "files = {\n";
		$count = 1;
		
		
		foreach($fileList as $file)
		{
			echo (($count > 1)?",":'').$count++ . ":{";
			$j = 1;
			foreach($file as $k=>$v)
			{
				
				if($k  == 'ctime' || $k == 'mtime')
				{
					$v = @date(DATE_TIME_FORMAT, $v);
				}	
				if($k == 'size')
				{
					$v = transformFileSize($v);
				}
				echo (($j++ > 1)?",":'') . "'" . $k . "':'" . $v . "'";
			}
			echo (($j++ > 1)?",":'') . "'url':'" . getFileUrl($file['path']) . "'";
			echo "}\n";				
		}
		echo  "};</script>\n";
	if(!empty($_GET['view']))
	{
		switch($_GET['view'])
		{
			case 'detail':
			case 'thumbnail':
			case 'text':	
				$view = $_GET['view'];
				break;
			default:
				$view = CONFIG_DEFAULT_VIEW;
		}
	}else 
	{
		$view = CONFIG_DEFAULT_VIEW;
	}	
	switch($view)
	{
		case 'text':
			//list file name only
			include_once(DIR_AJAX_ROOT . '_ajax_get_text_listing.php');
			break;
		case 'thumbnail':
			//list file with thumbnail
			include_once(DIR_AJAX_ROOT . '_ajax_get_thumbnail_listing.php');
			break;
		case 'detail':
		default:
			include_once(DIR_AJAX_ROOT . '_ajax_get_details_listing.php');
	}

	

?>

vieleicht kan mir mal jemand helfen .
 
Grüße,

also wenn ich mich jetzt nicht verschaut habe, dann ist besagte Zeile 57 die 1., in der die Variable '$text' verwendet wird.
Ich habe nun von dir keine Aussage über die Fehlermeldung erhalten, kann mir aber fast denken, in welche Richtung die gehen wird.

Du machst hier folgendes:
PHP:
$text .= $pagination->getPaginationHTML();

Falls $text hier zum 1. Mal vorkommt, dann ist die Variable für den Parser undefined, da falsch initialisiert.
Den Punkt vor dem Komma (nur in dieser Zeile!) entfernen...
Falls es wider Erwarten doch noch zu Fehlern kommen sollte, dann poste doch bitte mal die Fehlermeldung. Danke.
 
Erstmal Danke für deine Hilfe,

die fehlermeldung sieht so aus

Undefined variable: text in
e107_1\e107_plugins\testmanager2\ajax\ajaxfilemanager\ajax_get_file_listing.php
on line 58


wenn ich aus $text .= das mache $text = dann zereist das ganze layout und es fehlen teile
die scripte und css

wenn ich das ganze $text weglasse und nur $pagination->getPaginationHTML(); lasse

dann kommt der fehler wieder aber dismal für den nachsten $text .=
 
dann solltest du oberhalb der Schleife $text erstmal deklarieren, in der ajax_get_file_listing.php .

$text = '';
 
Zuletzt bearbeitet von einem Moderator:
ok

if(!isset($manager))
{
$text = '';
/**
* this is part of script for processing file paste
*/
//$_GET = $_POST;


habe da das $text reingebaut

jetzt der fehler weg aber er zeigt nix an eigentlich sollte er dann in den angeclickten ordner gehen

der link sieht so aus
e107_1/e107_plugins/testmanager2/ajax/ajaxfilemanager/ajax_get_file_listing.php?view=thumbnail&path=../uploaded/

wenn ich mir das auf einen neuen browser tab anschaue ist die seite weiss und im code ist nur

<head></head>
<body></body>

eigentlich sollte ajax den inhalt dann anzeigen
 
habe ich oben im ersten thread gemacht

das ganze ist eigentlich dier hier

http://www.phpletter.com/Demo/Ajax-File--Manager/

hier die ajax_get_file_listing.php

Code:
<?php 
 
    if(!isset($manager))
    {
        /**
         *  this is part of  script for processing file paste 
         */
        //$_GET = $_POST;
        include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
        include_once(CLASS_PAGINATION);
        $pagination = new pagination(false);
        if(!empty($_GET['search']))
        {
            include_once(CLASS_SEARCH);
            
            $search  = new Search($_GET['search_folder']);
            $search->addSearchKeyword('recursive', @$_GET['search_recursively']);
            $search->addSearchKeyword('mtime_from', @$_GET['search_mtime_from']);
            $search->addSearchKeyword('mtime_to', @$_GET['search_mtime_to']);
            $search->addSearchKeyword('size_from', @$_GET['search_size_from']);
            $search->addSearchKeyword('size_to', @$_GET['search_size_to']);
            $search->addSearchKeyword('recursive', @$_GET['search_recursively']);
            $search->addSearchKeyword('name', @$_GET['search_name']);
            $search->doSearch();
            $fileList = $search->getFoundFiles();
            $folderInfo = $search->getRootFolderInfo();         
            
        }else 
        {
            include_once(CLASS_MANAGER);
            include_once(CLASS_SESSION_ACTION);
            $sessionAction = new SessionAction();
            include_once(DIR_AJAX_INC . "class.manager.php");
        
            $manager = new manager();
            $manager->setSessionAction($sessionAction);
        
            $fileList = $manager->getFileList();
            $folderInfo = $manager->getFolderInfo();    
                        
        }
        $pagination->setUrl(CONFIG_URL_FILEnIMAGE_MANAGER); 
 
    }else 
    {
        include_once(CLASS_PAGINATION);
        $pagination = new pagination(false);            
    }
 
        
        $pagination->setTotal(sizeof($fileList));
        $pagination->setFirstText(PAGINATION_FIRST);
        $pagination->setPreviousText(PAGINATION_PREVIOUS);
        $pagination->setNextText(PAGINATION_NEXT);
        $pagination->setLastText(PAGINATION_LAST);
        $pagination->setLimit(!empty($_GET['limit'])?intval($_GET['limit']):CONFIG_DEFAULT_PAGINATION_LIMIT);
        echo $pagination->getPaginationHTML();
        echo "<script type=\"text/javascript\">\n";
        
        echo "parentFolder = {path:'" . getParentFolderPath($folderInfo['path']). "'};\n"; 
        echo 'currentFolder ={'; 
        $count =1;
        foreach($folderInfo as $k=>$v)
        {
            echo ($count++ == 1?'':',') . "'" . $k . "':'" . ($k=='ctime'|| $k=='mtime'?date(DATE_TIME_FORMAT, $v):$v)  . "'";
 
        }
        echo "};\n";
        $fileList = array_slice($fileList, $pagination->getPageOffset(), $pagination->getLimit());
        echo 'numRows = ' . sizeof($fileList) . ";\n";
        echo "files = {\n";
        $count = 1;
        
        
        foreach($fileList as $file)
        {
            echo (($count > 1)?",":'').$count++ . ":{";
            $j = 1;
            foreach($file as $k=>$v)
            {
                
                if($k  == 'ctime' || $k == 'mtime')
                {
                    $v = @date(DATE_TIME_FORMAT, $v);
                }   
                if($k == 'size')
                {
                    $v = transformFileSize($v);
                }
                echo (($j++ > 1)?",":'') . "'" . $k . "':'" . $v . "'";
            }
            echo (($j++ > 1)?",":'') . "'url':'" . getFileUrl($file['path']) . "'";
            echo "}\n";             
        }
        echo  "};</script>\n";
    if(!empty($_GET['view']))
    {
        switch($_GET['view'])
        {
            case 'detail':
            case 'thumbnail':
            case 'text':    
                $view = $_GET['view'];
                break;
            default:
                $view = CONFIG_DEFAULT_VIEW;
        }
    }else 
    {
        $view = CONFIG_DEFAULT_VIEW;
    }   
    switch($view)
    {
        case 'text':
            //list file name only
            include_once(DIR_AJAX_ROOT . '_ajax_get_text_listing.php');
            break;
        case 'thumbnail':
            //list file with thumbnail
            include_once(DIR_AJAX_ROOT . '_ajax_get_thumbnail_listing.php');
            break;
        case 'detail':
        default:
            include_once(DIR_AJAX_ROOT . '_ajax_get_details_listing.php');
    }
 
    
 
?>
 
path=../uploaded/ das sollte ein Problem sein.

path=../uploaded
 
Zuletzt bearbeitet von einem Moderator:
Zurück