Tech Reviews, Guides, Articles, and Forums for PC Hardware, Modding, and Gaming Enthusiasts
Fury-Tech Forums

Go Back   Fury-Tech Forums > Software Forums > Programming and Coding

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-01-2005, 10:36 AM
freshtokyo's Avatar
Great Diviner
Great Diviner
 
Join Date: Nov 2003
Location: In Maine
Posts: 1,638
Rep Power: 7
freshtokyo is on a distinguished road
Send a message via AIM to freshtokyo
Default PHP and damn numbers...

ok... so I don't have the greatest coding method I'm sure, but here's what I got. I'm displaying a catalog, named "DealerName1, Dealername2" etc. Clicking next brings you to the next page... but I'm trying to make it so that if it's an 8 page catalog it won't let you click to page 9 or a 16 page catalog clicking to page 17... (and not go back to page negative 1) so here's the code...

Code:
<?php
 $dealername = "fuccillo";
 $NumPages = 8;
 ?>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php echo $dealername ?></title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>
	<table width="700" border="0" cellspacing="0" cellpadding="0" align="LEFT" valign="TOP">
		<tr>
		<td></td>
			<td>
				<table border="0" cellspacing="0" cellpadding="0">
				<tr><td height="10" colspan="5"></td></tr>
				<tr>
				</tr>
				
 <?
 if (isset($_GET['PageNum']))	{
	$setnum = $_GET['PageNum'];
		
		
?>

				
					<td align="left" width="10">[img]images/backArrow.gif[/img]</td>
					<td align="left"><a class="redlink" href="index.php?PageNum=
					<? $setnum = $setnum-1; 
						if ($setnum > 1) {
							echo "";
							} elseif ($setnum >= 0) {
							echo "";
							} else {
					echo $setnum; 
					}
					?>"> BACK <? echo $setnum; ?></a></td> 
					<td align="center">VIEW AS PDF</td>
					<td align="right"><a class="redlink" href="index.php
						<? if ($setnum >= 9) {
								echo ""; 
								} else {
					 $setnum = $setnum+1; } echo "?PageNum="; echo $setnum ?>">NEXT </a></td>
					<td width="10">[img]images/nextArrow.gif[/img]</td>
					<tr>
					<td height="5" colspan="5"></td>
					</tr>
					<tr>
					
						<td align="center" colspan="5">
							<script>
							document.write("[img]images/<?php echo $dealername ?><?php $setnum = $setnum-1; echo $setnum ?>.jpg?"+Math.random()+"[/img]")
							</script>

						</td>
					</tr>
				</table>
				<? } else { ?>
				
					<td width="10">[img]images/backArrow.gif[/img] </td>
					<td align="left" class="regularGrey">BACK</td> 
					<td align="center" class="regularGrey">VIEW AS PDF</td>
					<td align="right">NEXT </td>
					<td width="10">[img]images/nextArrow.gif[/img]</td>
				
				</tr>
				<tr>
					<td height="5" colspan="5"></td>
					</tr>
					<tr>
					
						<td align="center" colspan="5">
							<script>
							document.write("[img]images/salesflyer.jpg?"+Math.random()+"[/img]")
							</script>

						</td>
					</tr>
				</table>
			<? } ?>
			</td>
			<td>[img]images/clearpixel.gif[/img]</td>
			<td align="left" width="250" valign="top">
			
			<table width="250" border="0" cellspacing="0" cellpadding="0" valign="top">
				<tr>
					<td height="1">[img]images/clearpixel.gif[/img]</td>
				</tr>
				<tr>
					<td width="250" height="61" valign="top">[img]images/instruct.gif[/img]</td>
				</tr>
				<tr>
					<td class="regularsm">
					<? include_once "nav.php"; ?>
					</td>
				</tr>
			</table>                                                                                                                                                 
			
			</td>
		</tr>
		<tr>
			
			
		</tr>
		
	</table>
</body>
</html>
The "Back" snippet seems to work... but I can't seem to get the "Next" to work correctly... and I know that my $NumPages = 8; isn't actually doing anything at this second, trying to make it work with with hardcoded number before I use that... any help is appreciated
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-01-2005, 10:49 AM
Technophile's Avatar
Super Moderator
Great Diviner
 
Join Date: Sep 2002
Location: Everywhere
Posts: 3,811
Rep Power: 10
Technophile is on a distinguished road
Send a message via AIM to Technophile Send a message via MSN to Technophile Send a message via Yahoo to Technophile
Default

You are checking the value of $setnum before you add 1 to it. You are checking if it is >=9. If it's 8, it's not greater than or equal to 9, so it will add one. If you change that to >=8, when you're already at page 8, it won't add one, if you're before page 8, it will add one. That's how it looks to me anyway.
__________________
Your sig is cooler than mine.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-01-2005, 11:26 AM
subsurfaced.com
Guest
 
Posts: n/a
Default code

matty t... replace lines 1 through 46 with this

Code:
<?php 
 $dealername = "fuccillo"; 
 $numpages = 8; 
 ?> 
  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<title><?php echo $dealername ?></title> 
<link href="style.css" rel="stylesheet" type="text/css"> 
</head> 

<body> 
   <table width="700" border="0" cellspacing="0" cellpadding="0" align="LEFT" valign="TOP"> 
      <tr> 
      <td></td> 
         <td> 
            <table border="0" cellspacing="0" cellpadding="0"> 
            <tr><td height="10" colspan="5"></td></tr> 
            <tr> 
            </tr> 
			<? 
			if (isset($_GET['PageNum']))   
			{ 
			  $setnum = $_GET['PageNum'];   
			?> 
               <td align="left" width="10">[img]images/backArrow.gif[/img]</td> 
               <td align="left"><? if(($setnum-1)>=1){?>BACK<? } ?></td> 
               <td align="center">VIEW AS PDF</td> 
               <td align="right"><? if(($setnum+1)<=$numpages){?>NEXT<? } ?></td> 
               <td width="10">[img]images/nextArrow.gif[/img]</td> 
               <tr> 
               <td height="5" colspan="5"></td> 
               </tr> 
               <tr> 
                
                  <td align="center" colspan="5"> 
                     <script> 
                     document.write("[img]images/<?php echo $dealername ?><?php $setnum = $setnum-1; echo $setnum ?>.jpg?"+Math.random()+"[/img]") 
                     </script> 

                  </td> 
               </tr> 
            </table> 
            <? } else { ?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-01-2005, 12:05 PM
Technophile's Avatar
Super Moderator
Great Diviner
 
Join Date: Sep 2002
Location: Everywhere
Posts: 3,811
Rep Power: 10
Technophile is on a distinguished road
Send a message via AIM to Technophile Send a message via MSN to Technophile Send a message via Yahoo to Technophile
Default

Yeah, that does make more sense.
__________________
Your sig is cooler than mine.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-01-2005, 02:27 PM
freshtokyo's Avatar
Great Diviner
Great Diviner
 
Join Date: Nov 2003
Location: In Maine
Posts: 1,638
Rep Power: 7
freshtokyo is on a distinguished road
Send a message via AIM to freshtokyo
Default

ok... that works for the most part... but there seems to be another problem...when you are on page number 1 the url reads http://web2.knowtechnology.net/Clients/FEGB/index.php?PageNum=1 BUT the view as pdf is of the second pdf, and the link to the next page is to page 3 not 2, upon clicking that link everything seems to straighten out but at then the images are a number behind...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-01-2005, 02:37 PM
Technophile's Avatar
Super Moderator
Great Diviner
 
Join Date: Sep 2002
Location: Everywhere
Posts: 3,811
Rep Power: 10
Technophile is on a distinguished road
Send a message via AIM to Technophile Send a message via MSN to Technophile Send a message via Yahoo to Technophile
Default

I just looked at that page and the numbers looked right to me... I assume you fixed it?
__________________
Your sig is cooler than mine.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-01-2005, 02:42 PM
freshtokyo's Avatar
Great Diviner
Great Diviner
 
Join Date: Nov 2003
Location: In Maine
Posts: 1,638
Rep Power: 7
freshtokyo is on a distinguished road
Send a message via AIM to freshtokyo
Default

nope... page 8 is supposed to be a corvette... not the service page (that's page 7)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-01-2005, 02:49 PM
subsurfaced.com
Guest
 
Posts: n/a
Default doh

you were defining to many setnum's that included additon and subtraction. also you really didn't nead pagenum. use the code below. seems to work fine... not 100% sure about images as they obviously don't resolve on my local web.

Code:
<?php 
 $dealername = "fuccillo"; 
 $numpages = 8; 
 ?> 
  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<title><?php echo $dealername ?></title> 
<link href="style.css" rel="stylesheet" type="text/css"> 
</head> 

<body> 
   <table width="700" border="0" cellspacing="0" cellpadding="0" align="LEFT" valign="TOP"> 
      <tr> 
      <td></td> 
         <td> 
            <table border="0" cellspacing="0" cellpadding="0"> 
            <tr><td height="10" colspan="5"></td></tr> 
            <tr> 
            </tr> 
			<? 
			if (isset($_GET['setnum']))   
			{ 
			  $setnum = $_GET['setnum'];   
			?> 
               <td align="left" width="10">[img]images/backArrow.gif[/img]</td> 
               <td align="left"><? if(($setnum-1)>=1){?>BACK<? } else { ?>BACK<? } ?></td> 
               <td align="center">VIEW AS PDF</td> 
               <td align="right"><? if(($setnum+1)<=$numpages){?>NEXT<? } ?></td> 
               <td width="10">[img]images/nextArrow.gif[/img]</td> 
               <tr> 
               <td height="5" colspan="5"></td> 
               </tr> 
               <tr> 
                
                  <td align="center" colspan="5"> 
                     <script> 
                     document.write("[img]images/<?php echo $dealername ?><?php echo $setnum ?>.jpg?"+Math.random()+"[/img]") 
                     </script> 

                  </td> 
               </tr> 
            </table> 
            <? } else { ?> 
             
               <td width="10">[img]images/backArrow.gif[/img] </td> 
               <td align="left" class="regularGrey">></td> 
               <td align="center" class="regularGrey">VIEW AS PDF</td> 
               <td align="right">NEXT </td> 
               <td width="10">[img]images/nextArrow.gif[/img]</td> 
             
            </tr> 
            <tr> 
               <td height="5" colspan="5"></td> 
               </tr> 
               <tr> 
                
                  <td align="center" colspan="5"> 
                     <script> 
                     document.write("[img]images/salesflyer.jpg?"+Math.random()+"[/img]") 
                     </script> 

                  </td> 
               </tr> 
            </table> 
         <? } ?> 
         </td> 
         <td>[img]images/clearpixel.gif[/img]</td> 
         <td align="left" width="250" valign="top"> 
          
         <table width="250" border="0" cellspacing="0" cellpadding="0" valign="top"> 
            <tr> 
               <td height="1">[img]images/clearpixel.gif[/img]</td> 
            </tr> 
            <tr> 
               <td width="250" height="61" valign="top">[img]images/instruct.gif[/img]</td> 
            </tr> 
            <tr> 
               <td class="regularsm"> 
               <? include_once "nav.php"; ?> 
               </td> 
            </tr> 
         </table>                                                                                                                                                  
          
         </td> 
      </tr> 
      <tr> 
          
          
      </tr> 
       
   </table> 
</body> 
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-01-2005, 02:52 PM
Technophile's Avatar
Super Moderator
Great Diviner
 
Join Date: Sep 2002
Location: Everywhere
Posts: 3,811
Rep Power: 10
Technophile is on a distinguished road
Send a message via AIM to Technophile Send a message via MSN to Technophile Send a message via Yahoo to Technophile
Default

Ooops, wasn't looking at the image file names...

Code:
                     <script>
                     document.write("[img]images/<?php echo $dealername ?><?php $setnum = $setnum-1; echo $setnum ?>.jpg?"+Math.random()+"[/img]")
You are subtracting one from $setnum for each image. Remove this:

Code:
$setnum = $setnum-1;
That should do it.

edit: Damn, too slow.
__________________
Your sig is cooler than mine.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-01-2005, 04:07 PM
freshtokyo's Avatar
Great Diviner
Great Diviner
 
Join Date: Nov 2003
Location: In Maine
Posts: 1,638
Rep Power: 7
freshtokyo is on a distinguished road
Send a message via AIM to freshtokyo
Default

sweet! Thanks you guys... works like a charm now
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Currently Viewing
Go Back   Fury-Tech Forums > Software Forums > Programming and Coding




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pretty damn creepy...if it's real Stella Jibber Jabber 3 06-07-2005 02:10 PM
Now thats fast! damn cable...... evilmonkeypower Jibber Jabber 0 06-22-2004 12:04 AM
Damn them! freshtokyo General Hardware 19 04-22-2004 05:15 PM
THE FUNNIEST DAMN THING EVAH NOMINATIONS Tekime Jibber Jabber 31 04-06-2004 10:34 AM
Damn weather! Tekime Jibber Jabber 0 12-17-2003 10:36 PM


All times are GMT -5. The time now is 08:15 PM.


PHP Scripts
BidVerve Directory
PageRank Script
SEO Scripts
37 SEO Scripts
List Cleaner Script
Keyword Cleaner
Directory Script
Directory Script

Directories
BidVerve Directory
BidVerve Directory
Nerve Directories
Nerve Directories
Directory Grow
Directory Grow

Our Supporters
entertainment sites
online casino

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0 ©2007, Crawlability, Inc.