function ShowTopMenu() { $top_menu_captions = array("Главная", "Новости", "Гостевая", "О сайте"); $top_menu_references = array("index.html", "#", "#", "#"); global $active_menu_index; for ($i = 0; $i < 4; $i++) { $active_menu_str="\t\t\t<li class=\"top_menu_li\""; if ($i == $active_menu_index) { $active_menu_str = $active_menu_str.' id="current_top_menu_li">'; $active_menu_str = $active_menu_str.$top_menu_captions[i]; } else { $active_menu_str = $active_menu_str.'><a href="'; $active_menu_str = $active_menu_str.$top_menu_references[i].'">'; $active_menu_str = $active_menu_str.$top_menu_captions[i]."</a>"; } $active_menu_str = $active_menu_str."</li>\n"; echo $active_menu_str; } } Вот такой код состряпал. Когда вызываешь эту функцию со страницы index.html ("Главная"), $active_menu_index равно 0. У index.html должен быть такой код: ... <li class="top_menu_li" id="current_top_menu_li">Главная</li> <li class="top_menu_li"><a href="">Новости</a></li> <li class="top_menu_li"><a href="">Гостевая</a></li> <li class="top_menu_li"><a href="">О сайте</a></li> ... Вместо этого получается вот так: ... <li class="top_menu_li" id="current_top_menu_li"></li> <li class="top_menu_li"><a href=""></a></li> <li class="top_menu_li"><a href=""></a></li> <li class="top_menu_li"><a href=""></a></li> ... Почему не происходит сцепление строк $active_menu_str и $top_menu_captions[i], а между $active_menu_str и $top_menu_references[i] происходит? Уже битый час парюсь. PS index.html, и этот php файл, где находится этот файл сохранен в формате windows-1251. В index.html задана кодировка windows-1251. PSS Пробовал массиву $top_menu_captions давать строки с английскими буквами и без спецсимволов и пробелов. Не помагает - oneAnd you will not get any error in connection with such a record? $ top_menu_captions [i]; // What is an "i"? - Deonis
- one@Deonis I guess there should be $ i - Bastian
- 2@rnddev, here and there is nothing to assume, based on the task and the desired result at the output. I'm more interested in the answer to my rhetorical question. How can I debug code when there is no error or warning output? It's like the sound engineer will listen to the audio recording, plugging his ears. - Deonis
- not checking sending files to the site - iTeam
|