![]() |
|
|
|
#1
|
|||
|
|||
|
This is so simple I know, but I can't seem to find exactly where to insert the code for this on myadopts.php --- I have a lot of adoptables and really need to have many pages.
I ganked the code ( two parts ) for the memberlist from the profile page, but not getting this inserted right: Code:
$article_content = $article_content."<br>";
if($currentpage > 1) {
$newpage = $currentpage - 1;
$article_content = $article_content."<b><a href='myadopts.php?page=".$newpage."'><img src='templates/icons/prev.gif' border=0> Previous Page</a></b> ";
}
else{
$article_content = $article_content."<b><img src='templates/icons/prev.gif' border=0> Previous Page</b> ";
}
if($currentpage < $totalpages) {
$newpage = $currentpage + 1;
$article_content = $article_content." :: <b><a href='myadopts.php?page=".$newpage."'>Next Page <img src='templates/icons/next.gif' border=0></a></b> ";
}
else{
$article_content = $article_content." :: <b>Next Page <img src='templates/icons/next.gif' border=0></b>";
}
thanks! |
|
#2
|
|||
|
|||
|
Please post the whole contents of your myadopts.php file. Do you get an error or does it just not work?
|
|
#3
|
|||
|
|||
|
thanks for the help! Well no error, it just isn't working, and I have so many adopts I will really need to be able to have them be on several pages soon -- and my members will too, for their own adopts page!
this is my entire myadopts.php, with I think none of the code I was trying to use--- I am not sure how to do this, but just want the list of my adopts to come up say, 10 to a page? and do that for every user of course. Alternately, if they could come up like 3 across and 10 down, that would be even better! Whatever is easiest to do .... Code:
<?php
// **********************************************************************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// **********************************************************************
// Wake the sleeping giant
// **********************************************************************
// Basic Configuration Info
// **********************************************************************
include("inc/functions.php");
include("inc/config.php");
include("lang/lang.php");
$themeurl = grabanysetting("themeurl");
// **********************************************************************
// Define our top links by calling getlinks()
// **********************************************************************
$links = getlinks();
// **********************************************************************
// Define our ads by calling getads()
// **********************************************************************
$ads = getads("any");
// **********************************************************************
// Grab any dynamic article content from the content table
// **********************************************************************
$pagecontent = getsitecontent("index");
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);
// **********************************************************************
// Grab any settings that we will need for the current page from the DB
// **********************************************************************
$browsertitle = grabanysetting("browsertitle");
$sitename = grabanysetting("sitename");
$slogan = grabanysetting("slogan");
// **********************************************************************
// Check and see if the user is logged in to the site
// **********************************************************************
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
// **********************************************************************
// End Prepwork - Output the page to the user
// This file lets a user manage their adoptables...
// **********************************************************************
$id = $_GET["id"];
$id = preg_replace("/[^a-zA-Z0-9s]/", "", $id);
$id = secure($id);
$act = $_GET["act"];
$act = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $act);
$act = secure($act);
$more = $_GET["more"];
$more = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $more);
$more = secure($more);
if($isloggedin == "yes"){
if($act == ""){
// No action specified, we just show all the adoptables with a manage link
$article_title = $loggedinname."'s Adoptables";
$article_content = $lang_adoptmanagement."<br>";
// We need to get all of the user's adoptables from the database and display them...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$gender=@mysql_result($result,$i,"gender");
// Our code to determine if we show the table or not...
$article_content = $article_content."<table width='440' border='1'><tr>";
// Output the table information...
// Get the current adoptable's image
$image = getcurrentimage($aid);
$article_content = $article_content."<p>".$name."</p><p>".$type."</p><p>".$gender."</p><a href='myadopts.php?act=manage&id=".$aid."'><img src='".$image."' border=0 width='100' height ='100'></a></p><p>
<b><a href='myadopts.php?act=manage&id=".$aid."'>Manage</a></b></p>";
$article_content = $article_content."</tr></table><br>";
$i++;
}
}
else if($act == "manage"){
// We are managing a specific adoptable
if($id == "" or !is_numeric($id)){
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
else{
// See if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$i++;
}
// Check that the adoptable exists for real, or show an error...
if($aid == $id){
// The adoptable does exist, so we show the image and junk to the user...
$image = getcurrentimage($id);
$article_title = "Managing ".$name;
$article_content = "<img src='".$img."' width='150' height ='150'><br><br>This page allows you to manage ".$name.". Click on an option below to change settings.<br><br>
<b><a href='levelup.php?id=".$id."'><img src='templates/icons/add.gif' border=0> Level Up ".$name."</a><br>
<a href='myadopts.php?act=stats&id=".$id."'><img src='templates/icons/stats.gif' border=0> View Profile for ".$name."</a><br>
<a href='myadopts.php?act=gift&id=".$id."'><img src='templates/icons/title.gif' border=0> Sell! ".$name."</a><br>
Add <a href='myadopts.php?act=deco&id=".$id."'>Decorations</a> to ".$name."<br>
<a href='myadopts.php?act=bbcode&id=".$id."'><img src='templates/icons/bbcodes.gif' border=0> Get BBCodes / HTML Codes for ".$name."</a><br>
<a href='myadopts.php?act=rename&id=".$id."'><img src='templates/icons/title.gif' border=0> Rename ".$name."</a><br>
<a href='myadopts.php?act=freeze&id=".$id."'><img src='templates/icons/freeze.gif' border=0> Freeze or Unfreeze ".$name."</a><br>
<a href='myadopts.php?act=kill&id=".$id."'><img src='templates/icons/delete.gif' border=0> Set Free ".$name."</a></b>";
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
} // End the MANAGE action code
else if($act == "stats"){
// We are getting the stats for the adoptable
// Check that an ID was submitted...
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$gender=@mysql_result($result,$i,"gender");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$i++;
}
if($aid == $id){
// The adoptable exists, so we show the stats for it...
$image = getcurrentimage($id);
$nextlevelexists = getnextlevelexists($type, $currentlevel);
$nextlevel = "";
// If a higher level exists, get that level's information...
if($nextlevelexists == "true"){
$nextlevel = $currentlevel + 1;
$query = "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$nextlevel'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i=0;
while ($i < 1) {
$requiredclicks=@mysql_result($result,$i,"requiredclicks"); //The adoptable's ID
$i++;
}
}
$article_title = $name."'s Statistics:";
$article_content = "<img src='".$image."'>".$extra."<br> <br>
<b>Total Clicks: ".$totalclicks."<br>
Current Level: ".$currentlevel."<br>
Next Level: ".$nloutput."<br></b>";
// Here I show the decorations for the pets.
$query2= "SELECT * FROM ".$prefix."deco WHERE petid = '".$aid."'";
$result2 = mysql_query($query2);
$numdeco = mysql_numrows($result2);
// if the number of rows is bigger than 0..
if($numdeco > 0){
$i=0;
while ($i < $numdeco) {
$id=@mysql_result($result2,$i,"id");
$type=@mysql_result($result2,$i,"type");
$extra = $extra . "<img src='decorations/".$type.".png'>";
$i++;
}
}
// number of rows is 0, means there isn't a pet - let's insert a space instead.
else{
$extra = " ";
}
// End grab next level info...
// Determine what to show for next level:
if($nextlevelexists == "true" and $nextlevel != ""){
// See how many more clicks to go
$ctg = $requiredclicks - totalclicks;
$nloutput = $nextlevel."<br>Clicks Required for Level Increase: ".$ctg;
}
else{
$nloutput = "This adoptable is at its maximum level";
}
$article_title = $name."'s Profile:";
$article_content = "<img src='".$image."'width='450' height ='450'>".$extra."<br>
<b>Total Clicks: ".$totalclicks."<br>
Gender: ".$gender."<br>
Current Level: ".$currentlevel."<br>
Next Level: ".$nloutput."<br></b>";
// Voters Information...
$article_content = $article_content."<h2>".$name."'s Voters:</h2><br>".$lang_voters_explain."<br><br><table width='450' border='1'>
<tr><td width='129'><strong>Username:</strong></td><td width='156'><strong>Date Voted: </strong></td><td width='82'><strong>Profile:</strong></td><td width='55'><strong>PM:</strong></td></tr>";
// Select the voters from the DB
$query = "SELECT * FROM ".$prefix."vote_voters WHERE adoptableid='$id' ORDER BY date DESC LIMIT 10";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i=0;
while ($i < $num) {
$date=@mysql_result($result,$i,"date");
$username=@mysql_result($result,$i,"username");
if($username == ""){
$username = "Guest";
}
if($username == "Guest"){
$article_content = $article_content."<tr>
<td><div align='left'>Guest</div></td>
<td><div align='left'>".$date."</div></td>
<td><div align='center'></div></td>
<td><div align='center'></div></td>
</tr>";
}
else{
$article_content = $article_content."<tr>
<td><div align='left'>".$username."</div></td>
<td><div align='left'>".$date."</div></td>
<td><div align='center'><a href='profile.php?user=".$username."' target='_blank'><img src='templates/buttons/profile.gif' border=0></a></div></td>
<td><div align='center'><a href='messages.php?act=newpm&user=".$username."' target='_blank'><img src='templates/buttons/pm.gif' border=0></a></div></td>
</tr>";
}
$i++;
}
$article_content = $article_content."</table><br>";
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
} // End the STATS code
else if($act == "bbcode"){
if(is_numeric($id)){
// Now we see if the adoptable actually exists...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$i++;
}
if($aid == $id){
$altbb = grabanysetting("usealtbbcode");
// Adoptable exists, so show the BBCode:
$article_title = "Codes for ".$name;
$article_content = $lang_bbcode_explain."<br>
<p><u>Forum Codes / BBCode: </u></p>
<p>
<textarea name='textarea' cols='50' rows='4'>
|
|
#4
|
|||
|
|||
|
Still haven't been able to get this to work, if anyone knows how to make the my adopts page with all my adopts be paginated --- to allow for many adopts w/o a mile long page, lol!
thanks! |
|
#5
|
||||
|
||||
|
I have a paginated version which I can PM you, but you'd have to look at the code and compare it with yours. Sound okay with you?
|
|
#6
|
|||
|
|||
|
sounds great!! thanks!! <333
|
|
#7
|
|||
|
|||
|
tried again to insert the right code. No go.
|
|
#8
|
|||
|
|||
|
I would like to have a paginated version.
Who can help me? |
|
#9
|
||||
|
||||
|
yes because when you start getting a ton, the page is three miles long lol.
I was sure I had it, but I am not getting it --- thanks in advance for the help :) |
|
#10
|
||||
|
||||
|
My script? Please PM me - I have some big modifications to the existing script in it and that's probably what's making the difference.
|
![]() |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Female Adopts can breed; male adopts only have 1. | Phoeniix | Questions and Supports | 2 | 11-09-2013 01:56 AM |
| problem with pagination or profile.php | kristhasirah | Questions and Supports | 0 | 01-16-2013 04:59 PM |
| Four Questions - Forum/Pagination/Levelup | AlexC | Questions and Supports | 32 | 04-22-2012 11:16 AM |
| Pagination/ My Adopts Page | Missy Master | Suggestions and Feature Requests | 13 | 01-23-2011 08:37 PM |
| adopt.php pagination | cetroline | Questions and Supports | 5 | 12-13-2010 06:41 PM |
What's New? |
What's Hot? |
What's Popular? |