PDA

View Full Version : Mys 1.3.1 place the money amount user has where you want to


schepers12
11-14-2012, 01:14 PM
hello all, i saw some people on this board wanted to have a separate money bar for the script (saw it in a very old post), well, here it is~ :3c

instructions provided in the board aswell the zip file~



please don't shoot me if i did something wrong, i'm a human and i do make mistakes, so please back-up your adoptables site before you start~!
It works for me though.. :3c


instructions below:

replace he original functions "getlinks, getsidebar" by these 3 functions in the main function file by this:

function getlinks(){
$isloggedin = $GLOBALS['isloggedin'];
if($isloggedin == "yes"){
//This function gets the links for the top bar from the database
// We will be getting our links from the database...
$links = "<div class='ddmenu'>\n
";

$stmt = $GLOBALS['adopts']->select("links", array(), "linkparent < 1 ORDER BY id ASC");

while ($category = $stmt->fetchObject()) {
$links .= "\n <a class='hide' href='{$category->linkurl}'>{$category->linktext}</a><br />
\n";
$stmt2 = $GLOBALS['adopts']->select("links", array(), "linkparent='{$category->id}' ORDER BY id ASC");
while($item = $stmt2->fetchObject()){
$links .= "&nbsp; - &nbsp; <a href='{$item->linkurl}' title='{$item->linktext}'>{$item->linktext}</a><br />";
}
$links .= "
\n";
}

$links .= "\n";
} else {
$links = "Please login or register first!";
}
return $links;
}
--------------------------------
--IF YOU HAVE THE HOUSE MOD INSTALLED, ADD THIS FUNCTION (under the getlinks function):
--
function getmoney() {
$isloggedin = $GLOBALS['isloggedin'];
$loggedinname = $GLOBALS['loggedinname'];
if($isloggedin == "yes") {
$sideba = "- You have {$GLOBALS['money']} {$GLOBALS['settings']['cost']}. <a href='donate.php'>Donate to users</a>";
$sideba .= "<br />- you have {$GLOBALS['houses']} houses. <a href='houses.php'>Buy more houses</a>";
} else { $sideba = ""; }
return $sideba;
}--------------------------------
--OTHERWISE, USE THIS:
function getmoney() {
$isloggedin = $GLOBALS['isloggedin'];
$loggedinname = $GLOBALS['loggedinname'];
if($isloggedin == "yes") {
$sideba = "You have {$GLOBALS['money']} {$GLOBALS['settings']['cost']}. <a href='donate.php'>Donate to users</a>";
} else { $sideba = ""; }
return $sideba;
}--------------------------------

function getsidebar() {
//This function determines what shows in the side bar of the template
$isloggedin = $GLOBALS['isloggedin'];
$loggedinname = $GLOBALS['loggedinname'];
if($isloggedin == "yes") {
$msgctr = "<a href='messages.php'>Messages</a>";
$data = $GLOBALS['adopts']->select("messages", array(), "touser='{$loggedinname}' and status='unread'")->fetchAll();

if(count($data) > 0) {
$msgctr = "<a href='messages.php'>Messages <b>(".count($data).")</b></a>";
}
$sidebar = "
<strong>Your links:</strong><br />
<ul><li><a href='adopt.php'>Adopt New Pets</a></li>
<li><a href='pound.php'>Acquire Pounded Pets</a></li>
<li><a href='myadopts.php'>Manage Adoptables</a></li>
<li><a href='account.php'>Go to My Account</a></li>
<li>{$msgctr}
<li><a href='changestyle.php'>Change Theme</a></li>
<li><a href='logout.php'>Log Out</a></li>";



$wpath =$GLOBALS['houses'];
$housing = $wpath;
$sidebar.= "<li><a href='houses.php'>you have {$housing} houses</a></li>";
$row = $GLOBALS['adopts']->select("users", array(), "username='{$loggedinname}' and usergroup='1'")->fetchObject();
if(is_object($row)) $sidebar .= "<li><a href='admincp/index.php'>Admin Center</a></li><br />";

$row1 = $GLOBALS['adopts']->select("online", array(), "username != 'Visitor'")->fetchAll();
$total1 = count($row1);
$row2 = $GLOBALS['adopts']->select("online", array(), "username = 'Visitor'")->fetchAll();
$total2 = count($row2);
$sidebar .= "<a href='online.php'>This site has {$total1} members and {$total2} guests online.</a></ul>";
}
else {
$sidebar = "<b><u>Member Login:</u></b><br />
<form name='form1' method='post' action='login.php'>
<p>Username:
<input name='username' type='text' id='username'>
</p>
<p>Password:
<p> <input name='password' type='password' id='password'>
</p>
<p>
<input type='submit' name='Submit' value='Log In'>
</p>
</form>Don't have an account?<br /><a href='register.php'>Register Free</a><br /><a href='forgotpass.php'>Forgot Password?</a>";
$row1 = $GLOBALS['adopts']->select("online", array(), "username != 'Visitor'")->fetchAll();
$total1 = count($row1);
$row2 = $GLOBALS['adopts']->select("online", array(), "username = 'Visitor'")->fetchAll();
$total2 = count($row2);
$sidebar .= "<br />This site currently has {$total1} members and {$total2} guests.";

}
return $sidebar;
}
_____________________________


then add the -modified- template "elements" in the templates folder, replace the original (difference with original is that the center is 800px wide in this mod)

______________________________
last:
replace the function showpage (almost at the end of the functions file) by this:



function showpage($title, $content, $date) {
$theme = $GLOBALS['usersettings']['theme'];
if ($theme == '') $theme = grabanysetting("theme");
$acpthemeurl = "../templates/acp/template.html";
$themeurl = "templates/{$theme}/template.html";
$patterns = array("/:ARTICLETITLE:/","/:ARTICLECONTENT:/", "/:ARTICLEDATE:/", "/:BROWSERTITLE:/", "/:SITENAME:/", "/:SLOGAN:/", "/:LINKSBAR:/", "/:SIDEFEED:/", "/:MONEY:/", "/:ADS:/");
// if we have said we are in an admin area, don't show ads and show admin links
if (defined("SUBDIR") and SUBDIR == "AdminCP") {
$replacements = array($title, $content, $date, grabanysetting("browsertitle")." ".$title, grabanysetting("sitename"), grabanysetting("slogan"), getadmlinks(), getsidebar(), getmoney(), "");
$template = file_get_contents($acpthemeurl);
}
else {
$replacements = array($title, $content, $date, grabanysetting("browsertitle")." ".$title, grabanysetting("sitename"), grabanysetting("slogan"), getlinks(), getsidebar(),getmoney(), getads("any"));
$template = file_get_contents($themeurl);
}
// now that we have our stuff, let's start making it all into a webpage

$template = preg_replace($patterns, $replacements, $template);
return $template;
}this modification is compatible with MYS 1.3.1
and provided by me~ :3
i hope you will enjoy this mod~ ^^

draugluin
11-18-2012, 12:47 PM
great !!!!

but I think, there's a little mistake in function getmoney. I've missed the r

function getmoney() {
-- $isloggedin = $GLOBALS['isloggedin'];
-- $loggedinname = $GLOBALS['loggedinname'];
-- if($isloggedin == "yes") {
-- $sidebar = "You have {$GLOBALS['money']} {$GLOBALS['settings']['cost']}. <a href='donate.php'>Donate to users</a>";
-- } else { $sidebar = ""; }
-- return $sidebar;
--}

but with "r" it works.

thank you :jay:

schepers12
11-19-2012, 02:32 PM
it's not an mistake, since it's a seperate variable, which is only used in this function, and it's called in the :MONEY: function in the template~ ;)

Hall of Famer
11-19-2012, 09:41 PM
Yeah, it really does not matter how you name your variable. The template finds patterns begins and ends with colon :, and replace them with php variables.

Anyway in Mys v1.3.3 or v1.3.4 I plan to make all GUI components into modules. This way you can manage their location on the screen with ease.