Warning: Cannot use a scalar value as an array in /home/admin/public_html/forum/include/fm.class.php on line 757

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/include/fm.class.php on line 770

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/topic.php on line 737
Форумы портала PHP.SU :: разбиение на страницы без mysql

 PHP.SU

Программирование на PHP, MySQL и другие веб-технологии
PHP.SU Портал     На главную страницу форума Главная     Помощь Помощь     Поиск Поиск     Поиск Яндекс Поиск Яндекс     Вакансии  Пользователи Пользователи


 Страниц (1): [1]   

> Без описания
foozzi
Отправлено: 04 Ноября, 2011 - 00:15:32
Post Id



Посетитель


Покинул форум
Сообщений всего: 283
Дата рег-ции: Май 2011  
Откуда: rm -rf /


Помог: 0 раз(а)




есть галерея, выводит имаги через jquery но сильно лагает когда много имагов, требуется разбить на страницы галерею, например после 10 картинок отображать "След. Страница"

сам код:

PHP:
скопировать код в буфер обмена
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>A Really Cool jQuery Gallery Demo | Tutorialzine</title>
  6. <link rel="stylesheet" type="text/css" href="lightbox/css/jquery.lightbox-0.5.css" />
  7. <link rel="stylesheet" type="text/css" href="demo.css" />
  8. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
  9. <script type="text/javascript" src="lightbox/js/jquery.lightbox-0.5.pack.js"></script>
  10. <script type="text/javascript" src="script.js"></script>
  11.  
  12. </head>
  13.  
  14. <body>
  15.  
  16. <div id="container">
  17.  
  18. <div id="heading">
  19. <h1>One life - One way</h1>
  20. </div>
  21.  
  22. <div id="gallery">
  23.  
  24. <?PHP
  25.  
  26. $directory = 'gallery';
  27.  
  28. $allowed_types=array('jpg','jpeg','gif','png');
  29. $file_parts=array();
  30. $ext='';
  31. $title='';
  32. $i=0;
  33.  
  34. $dir_handle = @opendir($directory) or die("There is an error with your image directory!");
  35.  
  36. while ($file = readdir($dir_handle))
  37. {
  38.         if($file=='.' || $file == '..') continue;
  39.        
  40.         $file_parts = explode('.',$file);
  41.         $ext = strtolower(array_pop($file_parts));
  42.  
  43.         $title = implode('.',$file_parts);
  44.         $title = htmlspecialchars($title);
  45.        
  46.         $nomargin='';
  47.        
  48.         if(in_array($ext,$allowed_types))
  49.         {
  50.                 if(($i+1)%4==0) $nomargin='nomargin';
  51.        
  52.                 echo '
  53.                 <div class="pic '.$nomargin.'" style="background:url('.$directory.'/'.$file.') no-repeat 50% 50%;">
  54.                 <a href="'.$directory.'/'.$file.'" title="'.$title.'" target="_blank">'.$title.'</a>
  55.                 </div>';
  56.                
  57.                 $i++;
  58.         }
  59. }
  60.  
  61. closedir($dir_handle);
  62.  
  63. ?>
  64. <div class="clear"></div>
  65. </div>
  66.  
  67. <div id="footer">
  68. <h2>Демо</h2>
  69. </div>
  70.  
  71. </div>
  72.  
  73. </body>
  74. </html>
  75.  

(Отредактировано автором: 04 Ноября, 2011 - 00:16:10)



-----
90% ошибок находятся в полуметре от монитора...
 
 Top
foozzi
Отправлено: 04 Ноября, 2011 - 16:42:38
Post Id



Посетитель


Покинул форум
Сообщений всего: 283
Дата рег-ции: Май 2011  
Откуда: rm -rf /


Помог: 0 раз(а)




any body ? =(


-----
90% ошибок находятся в полуметре от монитора...
 
 Top
Страниц (1): [1]
Сейчас эту тему просматривают: 0 (гостей: 0, зарегистрированных: 0)
« Вопросы новичков »


Все гости форума могут просматривать этот раздел.
Только зарегистрированные пользователи могут создавать новые темы в этом разделе.
Только зарегистрированные пользователи могут отвечать на сообщения в этом разделе.
 



Powered by PHP  Powered By MySQL  Powered by Nginx  Valid CSS  RSS

 
Powered by ExBB FM 1.0 RC1. InvisionExBB