Autor | Zpráva | ||
---|---|---|---|
maestorm Profil |
#1 · Zasláno: 7. 2. 2011, 14:14:47
Dobrý den,
chtěl bych Vás požádat o pomoc s hledáním chyby an atelier.wz.cz zřejmě se bude jednat o nějakou banalitu jako přidaná mezera, nebo smázlý znak, protože včera jsem na tyto webové stránky přidával nějaké obrázky a fungovalo mi to, ale potom jsem kvůli jednomu problému chtěl zasáhnout do kódu a zjevně jsem v něm lehce něco pokazil a teď nemohu přijít na to, co to bylo. Mohl bych Vás poprosit o pomoc při hledání onoho překlepu? Předem všem mockrát děkuji za případnou pomoc, už jsem z toho totiž celkem na nervy... http://www.atelier.wz.cz/index.php http://www.atelier.wz.cz/includes/gallery.php http://www.atelier.wz.cz/includes/title.php |
||
DJ Miky Profil |
#2 · Zasláno: 7. 2. 2011, 14:16:30
Věšteckou kouli nemáme, ale v souboru includes/gallery.php je na řádku 51 syntaktická chyba. Kód by pomohl, hlavně řádky 50 a 51.
|
||
maestorm Profil |
#3 · Zasláno: 7. 2. 2011, 14:18:30
já to tam hledám už druhý den a nenašel jsem to proto jsem se obrátil na mé oblíbené diskuzní fórum ;-)
|
||
maestorm Profil |
#4 · Zasláno: 7. 2. 2011, 14:21:55
<?php // PHP Gallery Navigation Script: Configuration set in index.php echo " <div id='gallery'>"; //starting variable $y = 0; // open file and set into array of thumbnails // append _tn to end of file name to access thumbnails // thumbnails must be have: // identical file names to full size images // no periods // same file type as full size images $fp = fopen($piclist, 'r'); while ($buffer= fgets($fp,4096)) { $image[$y] = explode("|", $buffer); $photo[$y] = str_replace(".", "_tn.", $image[$y][0]); $y++; } // calculate total number of images $result = count($photo); $pages = intval($result/$num_per_page); if ($result%$num_per_page != 0) { $pages++; } // numeric value of final image where initial image = 0 $suma = ($result-1); // calculate image values based on currently viewed image if (isset($_GET['a'])) { if (is_numeric($_GET['a'])) { $newa=$_GET['a']; } else { $newa=1; } $current_page = (($newa+1)%$num_per_page) ? intval(($newa+1)/$num_per_page)+1 : intval(($newa+1)/$num_per_page); $prev = ($newa-1); $next = ($newa+1); switch ($newa) { case 0: $prev = $suma; $next = 1; break; case $suma: $prev = ($suma - 1); $next = 0; break; } // display navigation links for image gallery // if "a" is set in the $_GET array: if ($display_image_nav == "above") { echo "n<div id="gallery_nav" class="gallery_nav_above">n<p><a href='?a=$prev'>$previous_text</a>$separator<a href="?a=$next">$next_text</a></p>n"; if ($skip_text != "") { echo "n<p><small><a href="#thumbs">$skip_text</a></small></p>n"; } echo "</div>"; } } else { $current_page = 1; if ($display_image_nav == "above") { // if "a" is NOT set: echo "n<div id="gallery_nav" class="gallery_nav_above">n<p><a href='?a=$suma'>$previous_text</a>$separator<a href="?a=1">$next_text</a></p>"; if ($skip_text != "") { echo "n<p><small><a href="#thumbs">$skip_text</a></small></p>n"; } echo "</div>"; } } echo "n<div class="gallery_description">n<h$header>$gallery_title</h$header>n<p>$description</p>n</div>"; // display current full sized image if get value is set if (isset($_GET['a'])) { if (is_numeric($_GET['a'])) { $a = $_GET['a']; } else { $a = 1; } $display = $image[$a][0]; $description = $image[$a][1]; $alt = $image[$a][2]; echo "n<div id="full_image">"; if ($caption_text_over == TRUE) { echo "n<p class="caption_text_over">$description</p>"; } echo "n<p><img src="$path/$display" alt="";if($alt_text==TRUE){echo $alt;}echo"" /></p>"; if ($caption_text_under == TRUE) { echo "n<p class="caption_text_under">$description</p>"; } } else { // display first image if no get value is set $display = $image[0][0]; $description = $image[0][1]; $alt = $image[0][2]; echo "n<div id='full_image'>"; if ($caption_text_over == TRUE) { echo "n<p class="caption_text_over">$description</p>"; } echo "n<p><img src='$path/$display' alt='";if($alt_text==TRUE){echo$alt;}echo"' /></p>"; if ($caption_text_under == TRUE) { echo "n<p class="caption_text_under">$description</p>"; } } echo "n</div>"; // display thumbnails in unordered list format echo " <div id='thumbs'>"; if ($display_thumbs_header == TRUE) { echo "n<h"; echo $header+1; echo ">$thumbnails_text</h"; echo $header+1; echo ">"; } echo "n<ul>"; $start = (($current_page-1)*$num_per_page); $finish = ($start + $num_per_page)-1; if ($finish > ($result - 1)) { $finish = $result - 1; } for ($i = $start; $i <= $finish; $i++){ if(is_file($path.'/'.$photo[$i])) { $alt = $image[$i][2]; if ($i == $a) { $current = " class='current_image'"; } else { $current = ""; } echo "n<li$current><a href='?a=$i'><img src='$path/$photo[$i]' alt='$alt' /></a></li>"; } } echo "n</ul></div>"; if (isset($_GET['a'])) { if ($display_image_nav == "below") { echo "n<div id="gallery_nav" class="gallery_nav_below">n<p><a href='?a=$prev'>$previous_text</a>$separator<a href="?a=$next">$next_text</a></p>n"; if ($skip_text != "") { echo "n<p><small><a href="#thumbs">$skip_text</a></small></p>n"; } echo "</div>"; } } else { $current_page = 1; if ($display_image_nav == "below") { // if "a" is NOT set: echo "n<div id="gallery_nav" class="gallery_nav_below">n<p><a href='?a=$suma'>$previous_text</a>$separator<a href="?a=1">$next_text</a></p> "; if ($skip_text != "") { echo "n<p><small><a href="#thumbs">$skip_text</a></small></p>n"; } echo "</div>"; } } if ($display_pagination == TRUE) { echo "n<div id="page_list"><ul>"; for($i=0;$i < $pages;$i++) { $image = $i * $num_per_page; $page_number = $i+1; if ($page_number == $current_page) { echo "n<li class="current_page" title="Current Page">$page_number</li>"; } else { echo "n<li><a href="?a=$image" title="$gallery_title, page $page_number">$page_number</a></li>"; } } echo "n</ul></div>"; } ?> |
||
Tori Profil |
#5 · Zasláno: 7. 2. 2011, 14:56:45 · Upravil/a: Tori
Uvozovky.
echo "n ..." znamená echo "\n.." ? |
||
maestorm Profil |
kód jsem si stáhl již dávno, byl to free template na online galerii, ale podruhé se mi už nepodařilo ten web najít... poradíte mi prosím někdo?
zde jsou zbylé 2 zdrojové kódy, kdyby byly třeba: <?php $y = 0; // open file and set into array of thumbnails // append _tn to end of file name to access thumbnails // thumbnails must be have: // identical file names to full size images // no periods // same file type as full size images $fp = fopen($piclist, 'r'); while ($buffer= fgets($fp,4096)) { $image[$y] = explode("|", $buffer); $photo[$y] = str_replace(".", "_tn.", $image[$y][0]); $y++; } if (isset($_GET['a'])) { if (is_numeric($_GET['a'])) { $a = $_GET['a']; } else { $a = 1; } if ($description_title == TRUE) { $img_title = $image[$a][1]; } else if ($alt_title == TRUE) { $img_title = $image[$a][2]; } } else { // display first image if no get value is set if ($description_title == TRUE) { $img_title = $image[0][1]; } else if ($alt_title == TRUE) { $img_title = $image[0][2]; } } $title_element = $gallery_title . $sep . $img_title . $sep . $sitename; echo "<title>$title_element</title>"; ?> <!DOCTYPE html> <html lang="cs"> <head> <title>Atelier a internetová galerie umělce Petra Biliny</title> <meta http-equiv="Content-Language" content="cs" /> <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" /> <link rel="stylesheet" type="text/css" title="styles" href="styles.css" /> <?php //THE SCRIPT// /*************************************/ // Configuration // /*************************************/ // Labels for Image Gallery Titles: $sitename = "On-line atelier a galerie Petra Biliny"; $sep = " - "; // title element separator // relative path to image folder $path = "photos"; // Number of thumbnail images displayed per page $num_per_page = 98; // title of this gallery $gallery_title = "Galerie děl Petra Biliny"; // text description of this gallery $description = "on-line prodejní galerie obrazů"; //optional // This controls the heading preceding the thumbnails group. $thumbnails_text = "náhledy"; $display_thumbs_header = TRUE; // Controls the display of the list of links to successive pages of the gallery. $display_pagination = TRUE; // Pick which field will supply unique title element text. // "TRUE" field is the source for the title element. $description_title = TRUE; $alt_title = FALSE; // heading level of gallery header [e.g. <h1>, <h2>] (string, 1-6); $header = "2"; // path + name of image index file (you can name the index // file whatever you want, just put that name here!) $piclist = "photos/titles.txt"; // Leave this set to TRUE if you want to include the description // text for the image in a paragraph underneath the image. $caption_text_under = TRUE; // Ditto, except that the caption would be above the image. $caption_text_over = FALSE; // Do you want to include an alternative text attribute on the // full size images? If you've left the description/caption turned on, // it may be preferable to disable the alternative text on these images. $alt_text = FALSE; // Whether the "previous" and "next links are visible, and above or below the full-sized image. $display_image_nav = "below"; #display_image_nav = "above"; #$display_image_nav = TRUE; // String separating the "previous" and "next" links $separator = " • "; $previous_text = "Previous"; $next_text = "Next"; // You can disable the skip link by setting this text to ""; $skip_text = ""; // Do you want to give me your public thanks? Hey! That's cool! Not required, though. $attribution = FALSE; $version = "1.2"; /***********************************/ // End Configuration // /***********************************/ include("includes/title.php"); ?> </head> <body> <div id="hidden"> <!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0--><!--WZ-REKLAMA-1.0IZ--><div align="center"><table width="496" border="0" cellspacing="0" cellpadding="0"><tr><td><a href="http://www.webzdarma.cz/"><img src="http://i.wz.cz/banner/nudle03.gif" width="28" height="60" style="margin: 0; padding: 0; border-width: 0" alt="WebZdarma.cz" /></a></td><td> <script type='text/javascript'><!--//<![CDATA[ var m3_u = (location.protocol=='https:'?'https':'http')+'://ad.wz.cz/openx/www/delivery/ajs.php'; var m3_r = Math.floor(Math.random()*99999999999); if (!document.MAX_used) document.MAX_used = ','; document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u); document.write ("?zoneid=18"); document.write ('&cb=' + m3_r); if (document.MAX_used != ',') document.write ("&exclude=" + document.MAX_used); document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : '')); document.write ("&loc=" + escape(window.location)); if (document.referrer) document.write ("&referer=" + escape(document.referrer)); if (document.context) document.write ("&context=" + escape(document.context)); if (document.mmm_fo) document.write ("&mmm_fo=1"); document.write ("'></scr"+"ipt>"); //]]>--></script><noscript><div><a href='http://ad.wz.cz/openx/www/delivery/ck.php?n=a5977468&cb=123'><img src='http://ad.wz.cz/openx/www/delivery/avw.php?zoneid=33&cb=123&n=a5977468' style='margin: 0; padding: 0; border-width: 0' alt='' /></a></div></noscript> </td></tr></table></div> <!--WZ-REKLAMA-1.0IK--> </div> <article> <header> <a href="http://www.atelier.wz.cz"><h1><img id="title_image" src="h4.png" /></h1></a> </header> <section> <h4>O autorovi</h4><img id="photography" src="foto.jpg" /> <p class="left_text">Petr Bilina se narodil 10.5. 1956 v Hlinsku v Čechách. Maloval již jako malý chlapec. Nejprve kreslil podle svých velkých vzorů Mikoláše Alše a Josefa Lady. Později jeho tvorbu ovlivnila LŠU ve Svitavách a dále lektorská činnost věnovaná výtvarníkům Svitavska profesory Královéhradecké PF Petrem Kmoškem, Bořivojem Borovským, akademickým malířem Jiřím Škopkem a PhDr. Zdeňkem Čubrdou. Výtvarný názor je ovlivněn poznáním tvorby starých mistrů i součastných autorů. Věnuje se jak tvorbě krajinných a městských scenérií, tak portrétů. V součastnosti převládá olejomalba. Je zastoupen v soukromých sbírkách jak v Čechách, tak i v Německu, Švédsku, USA, Kanadě, Japonsku. Je autorem "Svitavského Betlému" a prezentuje se i kresleným humorem a ilustracemi. Dle nabídky v menu (dílo), tvorba portrétů na objednávku přes e-mail <a href="mailto:bilina.petr@centrum.cz">bilina.petr@centrum.cz</a> Výstavy: od r. 1980 "Přehlídka výtvarníků Svitavska", r.2000-Hradec Králové (Everes), r.2001-Flörsheim am Main, 2004-hrad Mírov, 2006- Bánská Štiavnica. <a href="http://www.atelier.wz.cz/?a=0">Strana 1</a>, <a href="http://atelier.wz.cz/?a=98">Strana 2</a> </p> </section> </article> <?php include("includes/gallery.php"); // END THE GALLERY SCRIPT// ?> <footer> <nav> <div id="music_block"> <a href="http://jigsaw.w3.org/css-validator/check/referer"> <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" /> </a> </p> </div> </nav> </footer> <div id="foot"><p>Created by <a href="http://www.maestorm.wz.cz">maestorm.wz.cz</a> 2.12. 2009.</p></div> </body> </html> |
||
Thalia Profil |
#7 · Zasláno: 7. 2. 2011, 15:08:03 · Upravil/a: Thalia
Že tys to editoval ve správci souborů WZ? Obávám se, že tam budeš muset doplnit zpětná lomítka a pro příště ve správci už needitovat.
|
||
maestorm Profil |
#8 · Zasláno: 7. 2. 2011, 15:40:51
ano editoval, ale netuším, která zpětná lomítka máš na mysli, toto se mi ještě nikdy předtím nestalo a to jsem to editoval touto cestou již mnohokrát...
|
||
Thalia Profil |
#9 · Zasláno: 7. 2. 2011, 15:50:18 · Upravil/a: Thalia
Třeba řádek 68 má být správně takto:
echo "\n<div class=\"gallery_description\">\n<h$header>$gallery_title</h$header>\n<p>$description</p>\n</div>"; tj. v php kódu chybí lomítka před zalomením řádku \n a také u uvozovek při uvádění hodnot atributů. |
||
maestorm Profil |
#10 · Zasláno: 7. 2. 2011, 16:02:06
děkuji
|
||
maestorm Profil |
#11 · Zasláno: 7. 2. 2011, 16:21:32
udělal jsem to takto, ale stále mi to nejede:
<?php // PHP Gallery Navigation Script: Configuration set in index.php echo " <div id='gallery'>"; //starting variable $y = 0; // open file and set into array of thumbnails // append _tn to end of file name to access thumbnails // thumbnails must be have: // identical file names to full size images // no periods // same file type as full size images $fp = fopen($piclist, 'r'); while ($buffer= fgets($fp,4096)) { $image[$y] = explode("|", $buffer); $photo[$y] = str_replace(".", "_tn.", $image[$y][0]); $y++; } // calculate total number of images $result = count($photo); $pages = intval($result/$num_per_page); if ($result%$num_per_page != 0) { $pages++; } // numeric value of final image where initial image = 0 $suma = ($result-1); // calculate image values based on currently viewed image if (isset($_GET['a'])) { if (is_numeric($_GET['a'])) { $newa=$_GET['a']; } else { $newa=1; } $current_page = (($newa+1)%$num_per_page) ? intval(($newa+1)/$num_per_page)+1 : intval(($newa+1)/$num_per_page); $prev = ($newa-1); $next = ($newa+1); switch ($newa) { case 0: $prev = $suma; $next = 1; break; case $suma: $prev = ($suma - 1); $next = 0; break; } // display navigation links for image gallery // if "a" is set in the $_GET array: if ($display_image_nav == "above") { echo "\n<div id="gallery_nav" class=\"gallery_nav_above\">\n<p><a href='?a=$prev'>$previous_text</a>$separator<a href="?a=$next">$next_text</a></p>\n"; if ($skip_text != "") { echo "\n<p><small><a href="#thumbs">$skip_text</a></small></p>\n"; } echo "</div>"; } } else { $current_page = 1; if ($display_image_nav == "above") { // if "a" is NOT set: echo "\n<div id="gallery_nav" class=\"gallery_nav_above\">\n<p><a href='?a=$suma'>$previous_text</a>$separator<a href="?a=1">$next_text</a></p>"; if ($skip_text != "") { echo "\n<p><small><a href="#thumbs">$skip_text</a></small></p>\n"; } echo "</div>"; } } echo "\n<div class=\"gallery_description\">\n<h$header>$gallery_title</h$header>\n<p>$description</p>\n</div>"; // display current full sized image if get value is set if (isset($_GET['a'])) { if (is_numeric($_GET['a'])) { $a = $_GET['a']; } else { $a = 1; } $display = $image[$a][0]; $description = $image[$a][1]; $alt = $image[$a][2]; echo "\n<div id="full_image">"; if ($caption_text_over == TRUE) { echo "\n<p class=\"caption_text_over\">$description</p>"; } echo "\n<p><img src="$path/$display" alt="";if($alt_text==TRUE){echo $alt;}echo"" /></p>"; if ($caption_text_under == TRUE) { echo "\n<p class=\"caption_text_under\">$description</p>"; } } else { // display first image if no get value is set $display = $image[0][0]; $description = $image[0][1]; $alt = $image[0][2]; echo "\n<div id='full_image'>"; if ($caption_text_over == TRUE) { echo "\n<p class=\"caption_text_over\">$description</p>"; } echo "\n<p><img src='$path/$display' alt='";if($alt_text==TRUE){echo$alt;}echo"' /></p>"; if ($caption_text_under == TRUE) { echo "\n<p class=\"caption_text_under\">$description</p>"; } } echo "\n</div>"; // display thumbnails in unordered list format echo " <div id='thumbs'>"; if ($display_thumbs_header == TRUE) { echo "\n<h"; echo $header+1; echo ">$thumbnails_text</h"; echo $header+1; echo ">"; } echo "\n<ul>"; $start = (($current_page-1)*$num_per_page); $finish = ($start + $num_per_page)-1; if ($finish > ($result - 1)) { $finish = $result - 1; } for ($i = $start; $i <= $finish; $i++){ if(is_file($path.'/'.$photo[$i])) { $alt = $image[$i][2]; if ($i == $a) { $current = " class='current_image'"; } else { $current = ""; } echo "\n<li$current><a href='?a=$i'><img src='$path/$photo[$i]' alt='$alt' /></a></li>"; } } echo "\n</ul></div>"; if (isset($_GET['a'])) { if ($display_image_nav == "below") { echo "\n<div id="gallery_nav" class=\"gallery_nav_below\">\n<p><a href='?a=$prev'>$previous_text</a>$separator<a href="?a=$next">$next_text</a></p>\n"; if ($skip_text != "") { echo "\n<p><small><a href="#thumbs">$skip_text</a></small></p>n"; } echo "</div>"; } } else { $current_page = 1; if ($display_image_nav == "below") { // if "a" is NOT set: echo "\n<div id="gallery_nav" class=\"gallery_nav_below\">\n<p><a href='?a=$suma'>$previous_text</a>$separator<a href="?a=1">$next_text</a></p> "; if ($skip_text != "") { echo "\n<p><small><a href="#thumbs">$skip_text</a></small></p>\n"; } echo "</div>"; } } if ($display_pagination == TRUE) { echo "\n<div id="page_list"><ul>"; for($i=0;$i < $pages;$i++) { $image = $i * $num_per_page; $page_number = $i+1; if ($page_number == $current_page) { echo "\n<li class=\"current_page\" title="Current Page">$page_number</li>"; } else { echo "\n<li><a href="?a=$image" title="$gallery_title, page $page_number">$page_number</a></li>"; } } echo "\n</ul></div>"; } ?> chybí mi snad ještě někde \ ? |
||
Tori Profil |
#12 · Zasláno: 7. 2. 2011, 17:10:07
Pořád zůstává problém s uvozovkami, od řádku 51 dál. Např. na řádku 51 jsou některé správně escapované, jiné ne - jako by vám nějaký editor nahradil část apostrofů za uvozovky.
(Jen ze zvědavosti: co používáte za editor na php? Většina jich používá barevné zvýraznění kódu podobné zdejšímu, pak jsou podobné chyby lépe vidět.) |
||
maestorm Profil |
#13 · Zasláno: 7. 2. 2011, 17:47:23 · Upravil/a: maestorm
snažil jsem se to napravit (pracuji v Bluefish editoru v Ubuntu), ale stále mi to nefunguje:
<?php // PHP Gallery Navigation Script: Configuration set in index.php echo "<div id=\"gallery\">"; //starting variable $y = 0; // open file and set into array of thumbnails // append _tn to end of file name to access thumbnails // thumbnails must be have: // identical file names to full size images // no periods // same file type as full size images $fp = fopen($piclist, "r"); while ($buffer= fgets($fp,4096)) { $image[$y] = explode("|", $buffer); $photo[$y] = str_replace(".", "_tn.", $image[$y][0]); $y++; } // calculate total number of images $result = count($photo); $pages = intval($result/$num_per_page); if ($result%$num_per_page != 0) { $pages++; } // numeric value of final image where initial image = 0 $suma = ($result-1); // calculate image values based on currently viewed image if (isset($_GET["a"])) { if (is_numeric($_GET["a"])) { $newa=$_GET["a"]; } else { $newa=1; } $current_page = (($newa+1)%$num_per_page) ? intval(($newa+1)/$num_per_page)+1 : intval(($newa+1)/$num_per_page); $prev = ($newa-1); $next = ($newa+1); switch ($newa) { case 0: $prev = $suma; $next = 1; break; case $suma: $prev = ($suma - 1); $next = 0; break; } // display navigation links for image gallery // if "a" is set in the $_GET array: if ($display_image_nav == "above") { echo "\n<div id=\"gallery_nav\" class=\"gallery_nav_above\">\n<p><a href="?a=$prev">$previous_text</a>$separator<a href="?a=$next">$next_text</a></p>\n"; if ($skip_text != "") { echo "\n<p><small><a href="#thumbs">$skip_text</a></small></p>\n"; } echo "</div>"; } } else { $current_page = 1; if ($display_image_nav == "above") { // if "a" is NOT set: echo "\n<div id=\"gallery_nav\" class=\"gallery_nav_above\">\n<p><a href="?a=$suma">$previous_text</a>$separator<a href="?a=1">$next_text</a></p>"; if ($skip_text != "") { echo "\n<p><small><a href="#thumbs">$skip_text</a></small></p>\n"; } echo "</div>"; } } echo "\n<div class=\"gallery_description\">\n<h$header>$gallery_title</h$header>\n<p>$description</p>\n</div>"; // display current full sized image if get value is set if (isset($_GET["a"])) { if (is_numeric($_GET["a"])) { $a = $_GET["a"]; } else { $a = 1; } $display = $image[$a][0]; $description = $image[$a][1]; $alt = $image[$a][2]; echo "\n<div id=\"full_image\">"; if ($caption_text_over == TRUE) { echo "\n<p class=\"caption_text_over\">$description</p>"; } echo "\n<p><img src="$path/$display" alt="";if($alt_text==TRUE){echo $alt;}echo"" /></p>"; if ($caption_text_under == TRUE) { echo "\n<p class=\"caption_text_under\">$description</p>"; } } else { // display first image if no get value is set $display = $image[0][0]; $description = $image[0][1]; $alt = $image[0][2]; echo "\n<div id="full_image">"; if ($caption_text_over == TRUE) { echo "\n<p class=\"caption_text_over\">$description</p>"; } echo "\n<p><img src="$path/$display" alt="";if($alt_text==TRUE){echo$alt;}echo"" /></p>"; if ($caption_text_under == TRUE) { echo "\n<p class=\"caption_text_under\">$description</p>"; } } echo "\n</div>"; // display thumbnails in unordered list format echo " <div id="thumbs">"; if ($display_thumbs_header == TRUE) { echo "\n<h"; echo $header+1; echo ">$thumbnails_text</h"; echo $header+1; echo ">"; } echo "\n<ul>"; $start = (($current_page-1)*$num_per_page); $finish = ($start + $num_per_page)-1; if ($finish > ($result - 1)) { $finish = $result - 1; } for ($i = $start; $i <= $finish; $i++){ if(is_file($path."/".$photo[$i])) { $alt = $image[$i][2]; if ($i == $a) { $current = " class=\"current_image\""; } else { $current = ""; } echo "\n<li$current><a href="?a=$i"><img src="$path/$photo[$i]" alt="$alt" /></a></li>"; } } echo "\n</ul></div>"; if (isset($_GET["a"])) { if ($display_image_nav == "below") { echo "\n<div id=\"gallery_nav\" class=\"gallery_nav_below\">\n<p><a href="?a=$prev">$previous_text</a>$separator<a href="?a=$next">$next_text</a></p>\n"; if ($skip_text != "") { echo "\n<p><small><a href="#thumbs">$skip_text</a></small></p>n"; } echo "</div>"; } } else { $current_page = 1; if ($display_image_nav == "below") { // if "a" is NOT set: echo "\n<div id=\"gallery_nav\" class=\"gallery_nav_below\">\n<p><a href="?a=$suma">$previous_text</a>$separator<a href="?a=1">$next_text</a></p> "; if ($skip_text != "") { echo "\n<p><small><a href="#thumbs">$skip_text</a></small></p>\n"; } echo "</div>"; } } if ($display_pagination == TRUE) { echo "\n<div id=\"page_list\"><ul>"; for($i=0;$i < $pages;$i++) { $image = $i * $num_per_page; $page_number = $i+1; if ($page_number == $current_page) { echo "\n<li class=\"current_page\" title="Current Page">$page_number</li>"; } else { echo "\n<li><a href="?a=$image" title="$gallery_title, page $page_number">$page_number</a></li>"; } } echo "\n</ul></div>"; } ?> |
||
maestorm Profil |
#14 · Zasláno: 7. 2. 2011, 18:29:55 · Upravil/a: maestorm
ještě jednou Vás tímto žádám o pomoc, protože stránky mi stále nejedou a jak vidím vy ty chyby vidíte, já už jsem v php dlouho nic nedělal, tak jsem se v tom ztratil a byl bych Vám velice vděčný, kdybyste mi mohli poslat, jak má celý ten fungující kód vypadat. Děkuji
toto je současná podoba: <?php // PHP Gallery Navigation Script: Configuration set in index.php echo " <div id="gallery">"; //starting variable $y = 0; // open file and set into array of thumbnails // append _tn to end of file name to access thumbnails // thumbnails must be have: // identical file names to full size images // no periods // same file type as full size images $fp = fopen($piclist, 'r'); while ($buffer= fgets($fp,4096)) { $image[$y] = explode("|", $buffer); $photo[$y] = str_replace(".", "_tn.", $image[$y][0]); $y++; } // calculate total number of images $result = count($photo); $pages = intval($result/$num_per_page); if ($result%$num_per_page != 0) { $pages++; } // numeric value of final image where initial image = 0 $suma = ($result-1); // calculate image values based on currently viewed image if (isset($_GET['a'])) { if (is_numeric($_GET['a'])) { $newa=$_GET['a']; } else { $newa=1; } $current_page = (($newa+1)%$num_per_page) ? intval(($newa+1)/$num_per_page)+1 : intval(($newa+1)/$num_per_page); $prev = ($newa-1); $next = ($newa+1); switch ($newa) { case 0: $prev = $suma; $next = 1; break; case $suma: $prev = ($suma - 1); $next = 0; break; } // display navigation links for image gallery // if "a" is set in the $_GET array: if ($display_image_nav == "above") { echo "n<div id="gallery_nav" class="gallery_nav_above">n<p><a href="?a=$prev">$previous_text</a>$separator<a href="?a=$next">$next_text</a></p>n"; if ($skip_text != "") { echo "n<p><small><a href="#thumbs">$skip_text</a></small></p>n"; } echo "</div>"; } } else { $current_page = 1; if ($display_image_nav == "above") { // if "a" is NOT set: echo "n<div id="gallery_nav" class="gallery_nav_above">n<p><a href="?a=$suma">$previous_text</a>$separator<a href="?a=1">$next_text</a></p>"; if ($skip_text != "") { echo "n<p><small><a href="#thumbs">$skip_text</a></small></p>n"; } echo "</div>"; } } echo "n<div class="gallery_description">n<h$header>$gallery_title</h$header>n<p>$description</p>n</div>"; // display current full sized image if get value is set if (isset($_GET['a'])) { if (is_numeric($_GET['a'])) { $a = $_GET['a']; } else { $a = 1; } $display = $image[$a][0]; $description = $image[$a][1]; $alt = $image[$a][2]; echo "n<div id="full_image">"; if ($caption_text_over == TRUE) { echo "n<p class="caption_text_over">$description</p>"; } echo "n<p><img src="$path/$display" alt="";if($alt_text==TRUE){echo $alt;}echo"" /></p>"; if ($caption_text_under == TRUE) { echo "n<p class="caption_text_under">$description</p>"; } } else { // display first image if no get value is set $display = $image[0][0]; $description = $image[0][1]; $alt = $image[0][2]; echo "n<div id="full_image">"; if ($caption_text_over == TRUE) { echo "n<p class="caption_text_over">$description</p>"; } echo "n<p><img src='$path/$display' alt='";if($alt_text==TRUE){echo$alt;}echo"' /></p>"; if ($caption_text_under == TRUE) { echo "n<p class="caption_text_under">$description</p>"; } } echo "n</div>"; // display thumbnails in unordered list format echo " <div id="thumbs">"; if ($display_thumbs_header == TRUE) { echo "n<h"; echo $header+1; echo ">$thumbnails_text</h"; echo $header+1; echo ">"; } echo "n<ul>"; $start = (($current_page-1)*$num_per_page); $finish = ($start + $num_per_page)-1; if ($finish > ($result - 1)) { $finish = $result - 1; } for ($i = $start; $i <= $finish; $i++){ if(is_file($path.'/'.$photo[$i])) { $alt = $image[$i][2]; if ($i == $a) { $current = " class='current_image'"; } else { $current = ""; } echo "n<li$current><a href="?a=$i"><img src="$path/$photo[$i]" alt="$alt" /></a></li>"; } } echo "n</ul></div>"; if (isset($_GET['a'])) { if ($display_image_nav == "below") { echo "n<div id="gallery_nav" class="gallery_nav_below">n<p><a href="?a=$prev">$previous_text</a>$separator<a href="?a=$next">$next_text</a></p>n"; if ($skip_text != "") { echo "n<p><small><a href="#thumbs">$skip_text</a></small></p>n"; } echo "</div>"; } } else { $current_page = 1; if ($display_image_nav == "below") { // if "a" is NOT set: echo "n<div id="gallery_nav" class="gallery_nav_below">n<p><a href="?a=$suma">$previous_text</a>$separator<a href="?a=1">$next_text</a></p> "; if ($skip_text != "") { echo "n<p><small><a href="#thumbs">$skip_text</a></small></p>n"; } echo "</div>"; } } if ($display_pagination == TRUE) { echo "n<div id="page_list"><ul>"; for($i=0;$i < $pages;$i++) { $image = $i * $num_per_page; $page_number = $i+1; if ($page_number == $current_page) { echo "n<li class="current_page" title="Current Page">$page_number</li>"; } else { echo "n<li><a href="?a=$image" title="$gallery_title, page $page_number">$page_number</a></li>"; } } echo "n</ul></div>"; } ?> |
||
Tori Profil |
#15 · Zasláno: 7. 2. 2011, 18:46:14 · Upravil/a: Tori
Hm, Bluefish neumí (ve std. nastavení zvýrazňovače) rozlišit proměnnou v uvozovkách - zobrazuje ji naprosto chybně jako obyč.řetězec. To už je lepší obyč.texťák (např. gedit i Kate s tímhle nemají problém).
„vy ty chyby vidíte“ - Ve vrchním menu jděte na "Externí > Výstup > php". Dole se vám otevře panel s výpisem chyb.hlášek PHP stroje. Je to totéž, jako když ten soubor otevřete v browseru, ale nemusíte překlikávat okna. :) Nicméně bych stejně zkusila jiný editor - soudíc podle mé verzi Bluefishe funguje jeho zvýrazňovač dost kontraproduktivně. <?php // PHP Gallery Navigation Script: Configuration set in index.php echo '<div id="gallery">'; //starting variable $y = 0; // open file and set into array of thumbnails // append _tn to end of file name to access thumbnails // thumbnails must be have: // identical file names to full size images // no periods // same file type as full size images $fp = fopen($piclist, "r"); while ($buffer= fgets($fp,4096)) { $image[$y] = explode("|", $buffer); $photo[$y] = str_replace(".", "_tn.", $image[$y][0]); $y++; } // calculate total number of images $result = count($photo); $pages = intval($result/$num_per_page); if ($result%$num_per_page != 0) { $pages++; } // numeric value of final image where initial image = 0 $suma = ($result-1); // calculate image values based on currently viewed image if (isset($_GET["a"])) { if (is_numeric($_GET["a"])) { $newa=$_GET["a"]; } else { $newa=1; } $current_page = (($newa+1)%$num_per_page) ? intval(($newa+1)/$num_per_page)+1 : intval(($newa+1)/$num_per_page); $prev = ($newa-1); $next = ($newa+1); switch ($newa) { case 0: $prev = $suma; $next = 1; break; case $suma: $prev = ($suma - 1); $next = 0; break; } // display navigation links for image gallery // if "a" is set in the $_GET array: if ($display_image_nav == "above") { echo "\n".'<div id="gallery_nav" class="gallery_nav_above"> <p><a href="?a='.$prev.'">'.$previous_text.'</a>'.$separator.'<a href="?a='.$next.'">$next_text</a></p>'; if ($skip_text != "") { echo "\n".'<p><small><a href="#thumbs">'.$skip_text.'</a></small></p>'; } echo "</div>"; } } else { $current_page = 1; if ($display_image_nav == "above") { // if "a" is NOT set: echo "\n".'<div id="gallery_nav" class="gallery_nav_above"> <p><a href="?a='.$suma.'">'.$previous_text.'</a>'.$separator.'<a href="?a=1">'.$next_text.'</a></p>'; if ($skip_text != "") { echo "\n".'<p><small><a href="#thumbs">$skip_text</a></small></p>'; } echo "</div>"; } } echo "\n".'<div class="gallery_description">'."<h$header>$gallery_title</h$header>\n<p>$description</p>\n</div>"; // display current full sized image if get value is set if (isset($_GET["a"])) { if (is_numeric($_GET["a"])) { $a = $_GET["a"]; } else { $a = 1; } $display = $image[$a][0]; $description = $image[$a][1]; $alt = $image[$a][2]; echo "\n<div id=\"full_image\">"; if ($caption_text_over == TRUE) { echo "\n<p class=\"caption_text_over\">$description</p>"; } echo "\n".'<p><img src="'.$path.'/'.$display.'" alt="'; if($alt_text==TRUE){echo $alt;}echo '" /></p>'; if ($caption_text_under == TRUE) { echo "\n".'<p class="caption_text_under">'.$description.'</p>'; } } else { // display first image if no get value is set $display = $image[0][0]; $description = $image[0][1]; $alt = $image[0][2]; echo "\n".'<div id="full_image">'; if ($caption_text_over == TRUE) { echo "\n".'<p class="caption_text_over">'.$description.'</p>'; } echo "\n".'<p><img src="'.$path.'/'.$display.'" alt="'; if($alt_text==TRUE){echo $alt;} echo '" /></p>'; if ($caption_text_under == TRUE) { echo "\n<p class=\"caption_text_under\">$description</p>"; } } echo "\n</div>"; // display thumbnails in unordered list format echo ' <div id="thumbs">'; if ($display_thumbs_header == TRUE) { echo "\n<h"; echo $header+1; echo ">$thumbnails_text</h"; echo $header+1; echo ">"; } echo "\n<ul>"; $start = (($current_page-1)*$num_per_page); $finish = ($start + $num_per_page)-1; if ($finish > ($result - 1)) { $finish = $result - 1; } for ($i = $start; $i <= $finish; $i++){ if(is_file($path."/".$photo[$i])) { $alt = $image[$i][2]; if ($i == $a) { $current = " class=\"current_image\""; } else { $current = ""; } echo "\n<li$current><a href=\"?a=$i\"><img src=\"$path/{$photo[$i]}\" alt=\"$alt\" /></a></li>"; } } echo "\n</ul></div>"; if (isset($_GET["a"])) { if ($display_image_nav == "below") { echo "\n<div id=\"gallery_nav\" class=\"gallery_nav_below\">\n<p><a href=\"?a=$prev\">$previous_text</a>$separator<a href=\"?a=$next\">$next_text</a></p>\n"; if ($skip_text != "") { echo "\n".'<p><small><a href="#thumbs">$skip_text</a></small></p>'; } echo "</div>"; } } else { $current_page = 1; if ($display_image_nav == "below") { // if "a" is NOT set: echo "\n<div id=\"gallery_nav\" class=\"gallery_nav_below\">\n<p><a href=\"?a=$suma\">$previous_text</a>$separator<a href=\"?a=1\">$next_text</a></p>\n"; if ($skip_text != "") { echo "\n".'<p><small><a href="#thumbs">$skip_text</a></small></p>'; } echo "</div>"; } } if ($display_pagination == TRUE) { echo "\n<div id=\"page_list\"><ul>"; for($i=0;$i < $pages;$i++) { $image = $i * $num_per_page; $page_number = $i+1; if ($page_number == $current_page) { echo "\n<li class=\"current_page\" title=\"Current Page\">$page_number</li>"; } else { echo "\n<li><a href=\"?a=$image\" title=\"$gallery_title, page $page_number\">$page_number</a></li>"; } } echo "\n</ul></div>"; } ?> |
||
maestorm Profil |
#16 · Zasláno: 7. 2. 2011, 19:10:03
děkuji za rady! -> odinstaluji bluefish a instaluji si gedit ;-)
|
||
Časová prodleva: 14 let
|
0