Jump to content

question about how to do this...


belladonna

Recommended Posts

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. :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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. :D

Link to comment
Share on other sites

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");?>

Link to comment
Share on other sites

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>

 

 

Link to comment
Share on other sites

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?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.