From: "Евгений Миленченко" <alt@azer.net.ru>
To: community@altlinux.ru
Subject: Re: [Comm] вопрос по PHP
Date: Mon, 28 Jun 2004 01:18:17 +0400
Message-ID: <40DF3999.9090208@azer.net.ru> (raw)
In-Reply-To: <20040626182150.4e3d9045.greg@anastasia.ru>
[-- Attachment #1: Type: text/plain, Size: 1384 bytes --]
Независимо от номера запрашиваемой страницы Вы перебираете одни и те же
числа
и выводите одни и те же элементы массива, соответствующие этим числам.
Я приложил ваш код с комментариями и исправлениями, которые я счел
необходимым сделать.
Думаю, Вам лучше использовать готовые скрипты, коих есть великое
множество, например, на hotscripts.com
Насколько я понимаю, этот пост здесь - жуткий оффтопик, лучше обращаться
на спец. форумы.
Fateyev Grigory пишет:
>Здравствуйте!
>
>Помогите понять где ошибся?
>Скрипт читает каталог с фалами и выводит их по двадцать и формируются
>ссылки 1 2 3 4 5 и т.д., выводит первую страницу и при нажатии на
>следущие, выводятся опять первые 20 фотографий.
>По моему проблема в "for ($i=0; $i<$fotos_per_page; $i++)"? Но что не
>так, я не понимаю.
>
>if ($handle = @opendir("small")){
>while (false !== ($file = readdir($handle)))
> if ($file != "." && $file != "..") $filesarr[] = trim($file);
> $fotos_per_page = 20;
>$total_pages = ceil(count($filesarr)/$fotos_per_page);
> if (($_GET['from']<1) || ($_GET['from']>$total_pages)) $_GET['from']=1;
>for ($i=0; $i<$fotos_per_page; $i++)
> {
> echo "<img src='small/".$filesarr[$i]."' border=0><br><br>\n";
>}
> for ($i=0; $i<$total_pages; $i++)
>{
> if ($i==$_GET['from']) echo " $i ";
>else echo " <a href='?from=".($i+1)."'>".($i+1)."</a> ";
> }
>closedir($handle);
>}
>
>Спасибо!
>
>
>
[-- Attachment #2: index.php --]
[-- Type: application/hta, Size: 1517 bytes --]
[-- Attachment #3: Type: text/plain, Size: 82 bytes --]
Scanned by evaluation version of Dr.Web antivirus Daemon
http://drweb.ru/unix/
next prev parent reply other threads:[~2004-06-27 21:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-26 14:21 Fateyev Grigory
2004-06-27 21:18 ` Евгений Миленченко [this message]
2004-06-28 15:18 ` Fateyev Grigory
2004-06-29 3:44 ` Re[2]: " php-coder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=40DF3999.9090208@azer.net.ru \
--to=alt@azer.net.ru \
--cc=community@altlinux.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git