rosepose
03-12-2009, 04:07 PM
I want to put something like this:
<table style='width: 580px' class='vamid'><tr><th>Picture</th><th>Name</th><th>Level</th><th>Get Code</th><th> </th><th>Kill</th><th>Level</th><th>Clicks</th></tr><tr><td><a href="/view/Gvee"><img src="http://solaeria.com/images/3-09/309categg1.png" alt='Adult (♂) Image'/></a></td><td>Kairran</td><td><a href="http://solaeria.com/levelup.php?id=1">Level Up</a></td><td><a href="http://solaeria.com/manage.php?id=1&action=bbcode">Get Code</a></td><td> </td><td><a href= http://solaeria.com/manage.php?id=1&action=delete >Kill</a></td><td>0</td><td>99</td></tr></table>
Into my myadoptables.php page. The idea is that instead of everything being extremely spaced out and making the page huge, everything is spaced horizontally instead.
Well, it works OK, but I need a place to put my
</table>
tag so that it doesn't repeat. Where on the page can I place it?
-Rose
BMR777
03-12-2009, 04:50 PM
Your code has a </table> tag at the end, so why would you need two?
rosepose
03-12-2009, 05:07 PM
Oh, no :3 What I'm going to do is put it like this:
<table style='width: 580px' class='vamid'><tr><th>Picture</th><th>Name</th><th>Level</th><th>Get Code</th><th> </th><th>Kill</th><th>Level</th><th>Clicks</th></tr>
Right after that stuff about "here you can view your adoptables", yadda yadda.
Then, in the PHP bit about each individual adoptable, it's like this:
<tr><td><img src='".$imageurl."' border='0'></td>
<td><b><u>".$name.":</u></b></td>
<td><a href='levelup.php?id=".$id."'>LevelUp</a></td>
<td><a href='manage.php?id=".$id."&action=bbcode'>Get Code</a></td>
<td> </td><td><a href='manage.php?id=".$id."&action=delete'>Kill</a></td>
<td><b> ".$currentlevel."</b> </td>
<td><b> ".$totalclicks."</b> </td>
And then I need to stick the </table>
Tag right after that, but NOT in the PHP bit because I don't want it to loop :3
-Rose
BMR777
03-12-2009, 05:13 PM
On the current myadoptables.php find:
$article_content=$article_content."<p align='center'><b><u>".$name.":</u></b></p>
<p align='center'><img src='".$imageurl."' border='0'></p>
<b>Current level of ".$name.": ".$currentlevel."<br></b><b>Total clicks on ".$name.": ".$totalclicks."<br></b>
<b>Clicks needed until LevelUP ".$name.": ".$neededclicks."<br></b><br>
<a href='levelup.php?id=".$id."'>Click Here to LevelUP ".$name.".</a> (You can do this once per day)<br>
<a href='manage.php?id=".$id."&action=bbcode'>Click Here to get BBCODEs for ".$name.".</a> <br>
<a href='manage.php?id=".$id."&action=delete'>Click Here to Delete (Kill) ".$name.".</a> <br>";
/*
//This isn't done yet
<a href='manage.php?id=".$id."&action=rename'>Click Here to rename ".$name.".</a> <br>
<a href='manage.php?id=".$id."&action=kill'>Click Here to kill ".$name.".</a>";
*/
$i++;
}
Add After:
$article_content = $article_content."</table>";
rosepose
03-12-2009, 05:38 PM
Unfortunately it doesn't work :3 I tried it, and got something that said this:
Parse error: syntax error, unexpected T_VARIABLE in /home2/moxifero/public_html/solaeria/myadoptables.php on line 180
BMR777
03-12-2009, 06:12 PM
What's the full bit of code you are using?
rosepose
03-12-2009, 06:23 PM
<?php
// Easy Adoptables Script by Brandon Rusnak
// Get our includes out of the way
include("inc/functions.php");
include("inc/levels.php");
include("inc/config.php");
include("inc/settings.php");
include("inc/nbbc.php"); // BBCODE Parser
$bbcode = new BBCode;
// Connect to our database
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql database!');
mysql_select_db($dbname);
//Set up our login info...
$username = "";
$password = "";
//Check for cookie
if (isset($_COOKIE['adoptu']) and isset($_COOKIE['adoptp'])){
$username = $_COOKIE['adoptu'];
$password = $_COOKIE['adoptp'];
$username = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $username);
$password = preg_replace("/[^a-zA-Z0-9s]/", "", $password);
//Run login operation
$query = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");
$i++;
}
if($username == $luser and $password == $lpass){
$isloggedin = "yes";
}
else{
if (isset($_COOKIE['adoptu'])){
$past = time() - 10;
setcookie("adoptu",$username,$past);
}
if (isset($_COOKIE['adoptp'])){
$past = time() - 10;
setcookie("adoptp",$password,$past);
}
$isloggedin = "no";
}
}
else
{
//User is not logged in
$isloggedin = "no";
}
// Define our Template File
$file = $current_theme;
// Get our content for the index page
if($isloggedin != "yes"){
//User cannot have any adoptables because they are a guest
$article_title = "Permission Denied";
$article_date = date('Y-m-d');
$article_content = "We're sorry, but guests cannot adopt creatures. Please <a href='login.php'>login</a> or <a href='register.php'>register</a> to get your very own free adoptable.";
}
else{
//User IS logged in...
$article_title = $username."'s Adoptables";
$article_date = date('Y-m-d');
$article_content = "This page shows all of your current adoptables. Here you can view their progress, level them up, generate
HTML and BBCODEs to show them off to your friends, and more!<br>
<table style='width: 580px' class='vamid'><tr><th>Picture</th><th>Name</th><th>Level</th><th>Get Code</th><th> </th><th>Kill</th><th>Level</th><th>Clicks</th></tr>";
//Begin looping out our data................
$query = "SELECT * FROM owned_adoptables WHERE owner = '$username'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$id=@mysql_result($result,$i,"uid"); // Adoptable ID
$name=@mysql_result($result,$i,"name");
$imageurl=@mysql_result($result,$i,"imageurl");
$currentlevel=@mysql_result($result,$i,"currentlevel");
$totalclicks=@mysql_result($result,$i,"totalclicks");
if($currentlevel == 0){
$neededclicks = $level1c - $totalclicks;
$neededclicks = $neededclicks + 1;
}
if($currentlevel == 1){
$neededclicks = $level2c - $totalclicks;
$neededclicks = $neededclicks + 1;
}
if($currentlevel == 3){
$neededclicks = $level2c - $totalclicks;
$neededclicks = $neededclicks + 1;
}
if($currentlevel == 4){
$neededclicks = $level3c - $totalclicks;
$neededclicks = $neededclicks + 1;
}
if($currentlevel == 5){
$neededclicks = $level4c - $totalclicks;
$neededclicks = $neededclicks + 1;
}
if($currentlevel == 6){
$neededclicks = $level5c - $totalclicks;
$neededclicks = $neededclicks + 1;
}
if($currentlevel == 7){
$neededclicks = $level6c - $totalclicks;
$neededclicks = $neededclicks + 1;
}
if($currentlevel == 8){
$neededclicks = $level7c - $totalclicks;
$neededclicks = $neededclicks + 1;
}
if($neededclicks == ""){
$neededclicks = 0;
}
if($neededclicks < 0){
$neededclicks = "0 (Max Level)";
}
//Begin our content output...
$article_content=$article_content."
<tr><td><img src='".$imageurl."' border='0'></td>
<td><b><u>".$name.":</u></b></td>
<td><a href='levelup.php?id=".$id."'>LevelUp</a></td>
<td><a href='manage.php?id=".$id."&action=bbcode'>Get Code</a></td>
<td> </td><td><a href='manage.php?id=".$id."&action=delete'>Kill</a></td>
<td><b> ".$currentlevel."</b> </td>
<td><b> ".$totalclicks."</b> </td> <br>";
/*
//This isn't done yet
<a href='manage.php?id=".$id."&action=rename'>Click Here to rename ".$name.".</a> <br>
<a href='manage.php?id=".$id."&action=kill'>Click Here to kill ".$name.".</a>";
*/
$i++;
}
$article_content = $article_content."</table>";
}
// Should we show the extra pages in the nav bar?
$link1 = "";
if($show_extra_page1 == "yes"){
$link1 = "<li><a href='$extra_page1_link'>$extra_page1_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}
$link2 = "";
if($show_extra_page2 == "yes"){
$link2 = "<li><a href='$extra_page2_link'>$extra_page2_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}
// Do the template changes and echo the ready template
$template = file_get_contents($file);
$template = replace(':SITETITLE:',$site_title,$template);
$template = replace(':SITENAME:',$site_name,$template);
$template = replace(':ARTICLETITLE:',$article_title,$template) ;
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$templ ate);
$template = replace(':LINK1:',$link1,$template);
$template = replace(':LINK2:',$link2,$template);
$template = replace(':LINK3:',$link3,$template);
//Get the featured adoptable...
$featured = getfeatured();
$template = replace(':FEATURED:',$featured,$template);
//Ad Management
$header = @file_get_contents("ads/header.txt");
$footer = @file_get_contents("ads/footer.txt");
$tower = @file_get_contents("ads/tower.txt");
$header = stripslashes($header);
$footer = stripslashes($footer);
$tower = stripslashes($tower);
$template = replace(':HEADERAD:',$header,$template);
$template = replace(':FOOTERAD:',$footer,$template);
$template = replace(':TOWERAD:',$tower,$template);
//Is the user logged in?
//$isloggedin = "no";
if ($isloggedin == "yes"){
$template = replace(':WELCOMEORREGISTER:','<u>Welcome Back:</u>',$template);
$template = replace(':LOGINORACCT:', 'Welcome back '.$username.'. <br><br><a href="account.php">Click here to view or edit your account.</a><br><br><a href="logout.php">Log Out</a>' ,$template);
}
else{
//User is not logged in
$template = replace(':WELCOMEORREGISTER:','<u>Member Login:</u>',$template);
$loginform = "<form name='form1' method='post' action='login.php'>
<p>Username:
<input name='username' type='text' id='username'>
</p>
<p>Password:
<input name='password' type='password' id='password'>
</p>
<p>
<input type='submit' name='Submit' value='Submit'>
</p>
<p>Don't have an account?<br>
<a href='register.php'>Register Free</a> </p>
</form>
";
$template = replace(':LOGINORACCT:', $loginform ,$template);
}
echo $template;
?>
That's it. That's the one that I would be using, if it would work :3
BMR777
03-12-2009, 06:29 PM
That's odd. It looks ok to me, so I don't see why its not working. I'll have to look at it more.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.