Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Drop-down menu for myadopt.php [SOLVED] (http://www.mysidiaadoptables.com/forum/showthread.php?t=1104)

Seapyramid 09-29-2009 01:12 PM

RE: Drop-down menu for myadopt.php
 
Just a thought. What I have done to the "Manage" page for the new War Effort update to be released this week is a complete overhaul of the page so that it gives a lot of info in a neat formation. This way users don't have to click through a ton of links to look at the stats, bbc codes or whatever.

http://kypham.atlantisdesign.org/gro.../ss_manage.jpg

PHP Code:

      elseif ($act == "manage") {
          
// We are managing a specific adoptable
          
          
if ($id == "" or !is_numeric($id)) {
              
$article_title $err_idnoexist "<br /><br />";
              
$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) {
                  
//The adoptable's ID
                  
$aid = @mysql_result($result$i"aid");
                  
$currentlevel = @mysql_result($result$i"currentlevel");
                  
$type = @mysql_result($result$i"type");
                  
$name = @mysql_result($result$i"name");
                  
$totalclicks = @mysql_result($result$i"totalclicks");
                  
$race = @mysql_result($result$i"race");
                  
$primclass = @mysql_result($result$i"primclass");
                  
$secdclass = @mysql_result($result$i"secdclass");
                  
$valor = @mysql_result($result$i"valor");
                  
$valortimes = @mysql_result($result$i"valortimes");
                  
$health = @mysql_result($result$i"health");
                  
$isfrozen = @mysql_result($result$i"isfrozen");
                  
                  
$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...              
                  
                  
if ($isfrozen == "yes") {
                  
$status "<img src='templates/icons/freeze.gif' border=0 /> Forever Young";
              } else {
                  
$status "<img src='templates/icons/unfreeze.gif' border=0 /> Growing Strong";
              }
              
                      if (
$valor >= "20") {
                  
$vstatus1 "<img src='templates/icons/medal_silver.gif' border=0 /> ";
              } else {
                  
$vstatus1 " ";
              }
              
                      if (
$valor >= "50") {
                  
$vstatus2 "<img src='templates/icons/medal_gold.gif' border=0 /> ";
              } else {
                  
$vstatus2 " ";
              }
                  
                  
$image getcurrentimage($id);
                  
                  
$article_title "Managing " $name "<br /><br />";
                  
$article_content $found "<br />
                  <center><b><a href='myadopts.php'>Tree of Life</a></></center><br />
                  <table width='99%' align='center' border='0'><tr><td>
                  <center>" 
$vstatus1 " " $status " " $vstatus2 "</center>
                  <br /><img src='" 
$image "'></td>
                    <td><b>Current Level: " 
$currentlevel "<br />
                    Total Clicks: " 
$totalclicks "<br />
                    Race: " 
$race "<br />
                    Primary Class: " 
$primclass "<br />
                    Secondary Class: " 
$secdclass "<br />
                    Tours of Duty: " 
$valortimes "<br />
                    Valor: " 
$valor "/100<br />
                    Health: " 
$health "
                    </b></td></tr>
                    <tr><td>
                    
                    <b><a href='levelup.php?id=" 
$id "'>Train</a><br />
                    <a href='myadopts.php?act=rename&id=" 
$id "'>Rename</a><br />
                    <a href='myadopts.php?act=aband&id=" 
$id "'>Abandon</a><br />
                    <a href='myadopts.php?act=gift&id=" 
$id "'>Gift to another Caretaker</a><br />
                    </td><td>
                    <a href='myadopts.php?act=dorm&id=" 
$id "'>Send to the Dormantory</a><br />
                    <a href='myadopts.php?act=fame&id=" 
$id "'>Send to the Hall of Fame</a><br />
                    <a href='myadopts.php?act=trade&id=" 
$id "'>Send to the Trading Post</a></td></tr></table><br />";
                    
                                  
// 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) {
                      
//The adoptable's ID
                      
$requiredclicks = @mysql_result($result$i"requiredclicks");
                      
                      
                      
$i++;
                  }
              }
              
// 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 "Training needed for next level: " $ctg;
              } else {
                  
$nloutput "This Companion is fully trained!";
              }
              
              
// Voters Information...
              
              
$article_content $article_content "<h3>" $name "'s Trainers:</h3><br /><center>" $nloutput "</center><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last 10 people who trained your Companion. <br /><br />
              <table width='450' align='center' border='1'>
                <tr><td width='129'><strong>Caretaker</strong></td><td width='156'><strong>Date Trained</strong></td><td width='82'><strong>Tree of Life</strong></td><td width='55'><strong>Messenger Bird</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 />
                <p><u>Forum Codes / BBCode: </u></p>
                <p>
                  <textarea name='textarea' cols='50' rows='4'>[url=http://" 
$domain "" $scriptpath "/levelup.php?id=" $aid "][img]http://" $domain "" $scriptpath "/siggy.php?id=" $aid "[/img][/url]
                </textarea>
                </p>"
;
              
              if (
$altbb == "yes") {
                  
// Use the seo friendly alternate bbcodes...
                  
                  
$article_content $article_content "<p><u>Alternate BBCodes (Use if the above do not work on a forum): </u><br /><br /></p>
                    <p>
                      <textarea name='textarea' cols='50' rows='4'>[url=http://" 
$domain "" $scriptpath "/levelup.php?id=" $aid "][img]http://" $domain "" $scriptpath "/get/" $aid ".gif\[/img][/url]
                    </textarea>
                    </p>"
;
              }
              
              
              
                  
$article_content $article_content "<p><u>HTML Code</u>:<br /><br /></p>
                    <p>
                    <textarea name='textarea' cols='50' rows='4'><a href=\"http://" 
$domain "" $scriptpath "/levelup.php?id=" $aid "\" target=\"_blank\"><img src=\"http://" $domain "" $scriptpath "/siggy.php?id=" $aid "\" border=0></a>
                      </textarea>
                    </p>"
;        
                    
                    
              } else {
                  
$article_title $err_idnoexist "<br /><br />";
                  
$article_content $err_idnoexist_text "<br /><br />";
              }
          }
      }
      
// End the MANAGE action code 

A lot of that wouldn't be needed of course because it is very specific to Mystic Grove. But it can be implemented with relative ease.

Sea

arlecchina 10-06-2009 03:23 PM

RE: Drop-down menu for myadopt.php
 
Thanks so much to both of you,[/align] Bloodrun and Sea.

@Bloodrun - If you do find your code, I'd really appreciate looking at it.

@Sea - I will look into this too. Putting everything on one page may be preferable but I still want people to be able to choose another pet from the success page. I'm not sure if I'd still have the same issue if I use and edit your code...?

Bloodrun 10-07-2009 11:53 AM

RE: Drop-down menu for myadopt.php
 
Alright this is how I would do it if I were you, it isn't anything Fancy but it get's the job done:


PHP Code:

<p>
    <
select name='owned_adoptables' id='owned_adoptables'>";
      
// We need to stop here and fetch their adoptables...

    
$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 < $num) {

        
$aid=@mysql_result($result,$i,"aid");
        
$currentlevel=@mysql_result($result,$i,"currentlevel");
        
$name=@mysql_result($result,$i,"name");
    
    
$article_content = $article_content."<option value='".$aid."'>".$name." :: ".$currentlevel."</option>";    

    
$i++;
    }

$article_content = $article_content."</select>
</
p><br

If have any questions about just ask and I'll try my best to answer them.

arlecchina 10-07-2009 06:22 PM

RE: Drop-down menu for myadopt.php
 
Thanks so much, bloodrun! I'll try it out tomorrow.

Bloodrun 10-08-2009 07:45 AM

RE: Drop-down menu for myadopt.php
 
Quote:

Originally Posted by arlecchina
Thanks so much, bloodrun! I'll try it out tomorrow.

Your welcome, just post your questions and errors if you have any, and be able to make sure that you can tell exactly what you did, so I can fix any errors that you made have made along the way.

arlecchina 10-08-2009 02:46 PM

RE: Drop-down menu for myadopt.php
 
That worked except it only listed the adoptable in which I was on that page because of:
PHP Code:

$query "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'"

so I changed it to:
PHP Code:

$query "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname'"

and then it listed all the adoptables the owner had.

Thanks so much for your help!

Now I can code it to actually navigate to those pages. Thanks!

Bloodrun 10-09-2009 08:10 AM

RE: Drop-down menu for myadopt.php
 
Quote:

Originally Posted by arlecchina
That worked except it only listed the adoptable in which I was on that page because of:
PHP Code:

$query "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'"

so I changed it to:
PHP Code:

$query "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname'"

and then it listed all the adoptables the owner had.

Thanks so much for your help!

Now I can code it to actually navigate to those pages. Thanks!

Your welcome =D
Glad I could help.


All times are GMT -5. The time now is 06:35 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.