belladonna Posted August 25, 2007 Share Posted August 25, 2007 I have this code that a friend gave to me that she had learned in class that makes it show a link for the next page after four images and textarea boxes, I want to use that same code for displaying my layouts and flash players but cant seem to figure out how to get the link in the picture go to the actual layout, it tries to go to the actual image...Here is a link to the comment tags area to show you what i mean by how it makes the link automatically for the next page after 4 images. I hope that all made sense, lol http://www.belladonnasdarkgraphics.com/getwell.php I want to be able to do that, but with layouts and flash players. Quote Link to comment https://forums.phpfreaks.com/topic/66699-question-about-how-to-do-this/ Share on other sites More sharing options...
MadTechie Posted August 25, 2007 Share Posted August 25, 2007 not sure if this is what you want $page = (int)$_GET['page']; $pagefile = "page$page.php"; $PrevPagefile = "page".($page-1).".php"; $NextPagefile = "page".($page+1).".php"; include $pagefile; if( file_exists($PrevPagefile) && is_file($PrevPagefile) ) { echo "<a href='?page=".($page-1)."'>Previous Page</a>"; } if( file_exists($NextPagefile) && is_file($NextPagefile) ) { echo "<a href='?page=".($page+1)."'>Next Page</a>"; } hello page 1 page 2 etc etc EDIT: updated a few typos Quote Link to comment https://forums.phpfreaks.com/topic/66699-question-about-how-to-do-this/#findComment-334159 Share on other sites More sharing options...
belladonna Posted August 25, 2007 Author Share Posted August 25, 2007 http://www.belladonnasdarkgraphics.com/layout.php thats what the page looks like at the moment, I want the link on that pic of the layout to go to the actual layout, it keeps going to the layout page again,lol, I think I got all that other stuff there like you put, I just want the linkable part of that pic to go to the layout. Thanks though. Quote Link to comment https://forums.phpfreaks.com/topic/66699-question-about-how-to-do-this/#findComment-334161 Share on other sites More sharing options...
MadTechie Posted August 25, 2007 Share Posted August 25, 2007 erm.. thats basic html.. your linking to itself.. you may want to post the code.. Quote Link to comment https://forums.phpfreaks.com/topic/66699-question-about-how-to-do-this/#findComment-334166 Share on other sites More sharing options...
belladonna Posted August 25, 2007 Author Share Posted August 25, 2007 ok, here is the code, I hope it all shows up in here, sorry if its basic and I am just overlooking it, lol <?php include("header.html");?> <h3>Layouts</h3> <!-- start main content --> <td width="550" valign="top" style="padding:3px;"> <?php $title = "Myspace family"; ?> <table width="100%"> <tr> <td> <? // Configure these values for your site $img_url = "s4.photobucket.com/albums/y104"; $site_url = "belladonnasdarkgraphics.com/layout.php"; // no http, no trailing / $site_name = "Belladonna's Dark Graphics"; $support_image = "i4.photobucket.com/albums/y104/vampgoddess30/promote/1.gif"; // support_image is a logo for your site that will be placed in the top // left of the users myspace page. Leave this blank if you don't want // to use a support image. $cat = 'layout/'; $urlpath = '/layout/'; $imgpath = '/vampgoddess30/screenshots/'; $max2show = 4; //Amount you want to show per page // END OF CONFIGURATION SECTION // Do not edit below this line $hook = opendir($cat) or die('cant open dir'); $total = 0; if(!isset($_GET['page'])) $page = 1; else $page = $_GET['page']; $start = $max2show * $page - $max2show; $end = $page * $max2show; $ext = array("jpg", "png", "jpeg", "gif"); while (false!==($file = readdir($hook))) { for($i=0;$i<sizeof($ext);$i++) if (stristr($file, ".".$ext[$i])) //NOT case sensitive { $files[] = $file; $total++; } } closedir($hook); natcasesort($files); $files = array_values($files); if ($end > $total) { $end = $total; } echo '<table width="100%" border="0" cellspacing="0" cellpadding="4" border="0" bgcolor="#000000" style="border-bottom: 0px solid #cccccc"><tr>'; //if ($cnt >= $start && $cnt < $end) if(isset($_GET['page'])&&($_GET['page'] != 1)) { $pre = $_GET['page'] - 1; echo '<td align="left" width="38%"><a href="' . $_SERVER['PHP_SELF'] . '?page=' . $pre . '"><b>Previous Page</b></a></td>'; } $pages = $total/$max2show; $lastpage = ceil($pages); echo '<td></td>'; if($page < $lastpage) { $next = $page + 1; echo '<td align="right" width="45%"><a href="' . $_SERVER['PHP_SELF'] . '?page=' . $next . '"><b>Next Page</b></a></td>'; } echo '</tr> </table><br />'; for ($cnt = $start; $cnt < $end; $cnt++) { $file = $files[$cnt]; ?> <table border="0" width="100%" align="center" cellpadding="4" cellspacing="4" style="border-bottom: 1px dashed #cccccc"> <tr> <td valign="top" style="padding-left: 10px;" align="center"> <a href="http://<?php echo $site_url; ?>" target="_blank" title="<?php echo $urlpath . $file; ?>"><img src="http://<?php echo $img_url . "/" . $imgpath . $file; ?>" alt="<?php echo $file; ?>" width="300" ></a><br> </tr> </table> <? }//for echo '<br /><table width="100%" border="0" cellspacing="0" cellpadding="4" border="0" bgcolor="#000000" style="border-bottom: 0px solid #cccccc"><tr>'; if(isset($_GET['page'])&&($_GET['page'] != 1)) { $pre = $_GET['page'] - 1; echo '<td align="left" width="38%"><a href="' . $_SERVER['PHP_SELF'] . '?page=' . $pre . '"><b>Previous Page</b></a></td>'; } echo '<td></td>'; if($page < $lastpage) { $next = $page + 1; echo '<td align="right" width="45%"><a href="' . $_SERVER['PHP_SELF'] . '?page=' . $next . '"><b>Next Page</b></a></td>'; } echo '</tr> </table>'; ?> </td> </tr> </table> </td> <!-- end main content --> <?php include("footer.html");?> Quote Link to comment https://forums.phpfreaks.com/topic/66699-question-about-how-to-do-this/#findComment-334179 Share on other sites More sharing options...
MadTechie Posted August 25, 2007 Share Posted August 25, 2007 you have the href set to the same page.. $site_url = "belladonnasdarkgraphics.com/layout.php"; // no http, no trailing / //...snip...// <a href="http://<?php echo $site_url; ?>" target="_blank" title="<?php echo $urlpath . $file; ?>"><img src="http://<?php echo $img_url . "/" . $imgpath . $file; ?>" alt="<?php echo $file; ?>" width="300" ></a><br> Quote Link to comment https://forums.phpfreaks.com/topic/66699-question-about-how-to-do-this/#findComment-334184 Share on other sites More sharing options...
belladonna Posted August 26, 2007 Author Share Posted August 26, 2007 you have the href set to the same page.. $site_url = "belladonnasdarkgraphics.com/layout.php"; // no http, no trailing / //...snip...// <a href="http://<?php echo $site_url; ?>" target="_blank" title="<?php echo $urlpath . $file; ?>"><img src="http://<?php echo $img_url . "/" . $imgpath . $file; ?>" alt="<?php echo $file; ?>" width="300" ></a><br> ok, so i still havent got it yet, what do i need to change in that code that to so it will work right? Quote Link to comment https://forums.phpfreaks.com/topic/66699-question-about-how-to-do-this/#findComment-334670 Share on other sites More sharing options...
lightningstrike Posted August 26, 2007 Share Posted August 26, 2007 If I'm not mistaken they meant that $site_url = "belladonnasdarkgraphics.com/layout.php"; should be instead equal to the base domain. $site_url = "belladonnasdarkgraphics.com"; Quote Link to comment https://forums.phpfreaks.com/topic/66699-question-about-how-to-do-this/#findComment-334685 Share on other sites More sharing options...
belladonna Posted August 26, 2007 Author Share Posted August 26, 2007 ok, just changed it now it just goes to the main page. Quote Link to comment https://forums.phpfreaks.com/topic/66699-question-about-how-to-do-this/#findComment-334703 Share on other sites More sharing options...
belladonna Posted September 1, 2007 Author Share Posted September 1, 2007 can someone just let me know what i need to change it to for that code to work with layouts? please? Quote Link to comment https://forums.phpfreaks.com/topic/66699-question-about-how-to-do-this/#findComment-339060 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.