lynx
Advanced lynx | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору trew Цитата: прописывается в lastpost.cgi эта $nm правильно | Если она правильно прописывается, значите ее можно правильно прочитать Вот этот код: Код: my @lastpost; my ($inforum, $threadnumber, $topictitle, $startnumber, $nm); $filetoopen = "$ikondir" . "forum$forumid/lastpost.cgi"; open(FILE,"$filetoopen"); flock(FILE,2); @lastpost = <FILE>; close(FILE); foreach $lastpost (@lastpost) { chomp $lastpost; ($inforum, $threadnumber, $topictitle, $startnumber, $nm) = split(/\|/,$lastpost); $lastpostname = substr($topictitle, 0, 30); } if ($inforum eq "") { $lastpost = ""; } # DimoN #elsif ($privateforum eq "yes") { #$lastpost = ""; #} else { $lastpost = qq~<img src="$imagesurl/images/lastpost.gif"> <a href="$threadprog?forum=$inforum&topic=$threadnumber&start=$startnumber">$lastpostname...</a>~; } | Напишите (на примере Антуана) так: Код: my @lastpost; my ($inforum, $threadnumber, $topictitle, $startnumber, $nm); $filetoopen = "$ikondir" . "forum$forumid/lastpost.cgi"; open(FILE,"$filetoopen"); flock(FILE,2); @lastpost = <FILE>; close(FILE); foreach $lastpost (@lastpost) { chomp $lastpost; ($inforum, $threadnumber, $topictitle, $startnumber, $nm) = split(/\|/,$lastpost); $lastpostname = substr($topictitle, 0, 30); } if ($inforum eq "") { $lastpost = ""; } else { $lastpost = qq~<img src="$imagesurl/images/lastpost.gif"> <a href="$threadprog?forum=$inforum&topic=$threadnumber&start=$startnumber#$nm">$lastpostname...</a>~; } | Теперь запоститите в теме, где больше одной страницы, и бегите на главную смотреть ластпост. Добавлено Даже лучше так (хотя в данном случае роли не играет): Код: my @lastpost; my ($inforum, $threadnumber, $topictitle, $startnumber, $nm); my $filetoopen = "$ikondir" . "forum$forumid/lastpost.cgi"; &stripMETA($filetoopen); open(FILE,"$filetoopen"); flock(FILE,1); @lastpost = <FILE>; close(FILE); foreach $lastpost (@lastpost) { chomp $lastpost; ($inforum, $threadnumber, $topictitle, $startnumber, $nm) = split(/\|/,$lastpost); $lastpostname = substr($topictitle, 0, 30); } if ($inforum eq "") { $lastpost = ""; } else { $lastpost = qq~<img src="$imagesurl/images/lastpost.gif"> <a href="$threadprog?forum=$inforum&topic=$threadnumber&start=$startnumber#$nm">$lastpostname...</a>~; } | Если не сработает, тогда так: Код: my @lastpost; my ($inforum, $threadnumber, $topictitle, $startnumber, $nm); my $filetoopen = "$ikondir" . "forum$forumid/lastpost.cgi"; &stripMETA($filetoopen); open(FILE,"$filetoopen"); flock(FILE,1); @lastpost = <FILE>; close(FILE); foreach $lastpost (@lastpost) { chomp $lastpost; ($inforum, $threadnumber, $topictitle, $startnumber, $nm) = split(/\|/,$lastpost); $lastpostname = substr($topictitle, 0, 30); $lp=$nm; } if ($inforum eq "") { $lastpost = ""; } else { $lastpost = qq~<img src="$imagesurl/images/lastpost.gif"> <a href="$threadprog?forum=$inforum&topic=$threadnumber&start=$startnumber#$lp">$lastpostname...</a>~; } | Наверное, из-за того, что переменные заданы, как локальные, они дальше своего цикла и не видны. Последний вариант точно должен работать. При условии, конечно, что переменная $nm действительно корректо пишется |