View Single Post
  #2  
Old 06-24-2017, 03:43 PM
parayna's Avatar
parayna parayna is offline
Member
 
Join Date: May 2013
Location: Devon, UK
Posts: 342
Gender: Female
Credits: 16,538
parayna is on a distinguished road
Default More stuff

class_template.php assigning the images etc:
PHP Code:
    private function assignTemplateVars(){
        
$mysidia Registry::get("mysidia");
        
$this->assign("version"Mysidia::version);
        
$this->assign("root"$this->scriptRoot);
        
$this->assign("home"$this->tempRoot);
        
$this->assign("temp"$this->temp);
        
$this->assign("css"$this->css);
        
$this->assign("js"$this->js);   
        
$this->assign("logged_in",$mysidia->user->isloggedin);
        
$this->assign("isAdmin",$mysidia->user instanceof Admin); 
        
$this->assign("username",$mysidia->user->username); 
        
$this->assign("cash",$mysidia->user->getcash());
        
$this->assign("premium",$mysidia->user->premiumcurrency);      
        
$gemimg "<img src='{$root}/templates/icons/diamond.png' width= '19px' alt = 'gems' title = 'Gems'>";
        
$this->assign("gemicon",$gemimg);  
        
$creditsimg "<img src='{$root}/templates/icons/credits.png' alt = 'credits' title = 'Credits'>";
        
$this->assign("creditsicon",$creditsimg);  
        
$dotimg "<img src='{$root}/templates/icons/dot.png'>";
        
$this->assign("dot",$dotimg);
        
$messages $mysidia->db->select("messages", array(), "touser='{$mysidia->user->username}' and status='unread'")->rowCount(); 
        
$this->assign("messages",$messages);      
        
$profile $mysidia->db->select("users_profile", array("uid""avatar"), "username = '{$mysidia->user->username}'")->fetchObject();
        
$img "<img src='../../".$profile->avatar."' class='avatar'>";
        
$this->assign("avatar",$img);          
        
$online $mysidia->db->select("online", array(), "username != 'Visitor'")->rowCount();
        
$this->assign("online","{$online} User(s) Online");  
        
$now = new DateTime();        
        
$hrs $now->format('I');
        if (
$hrs 0$msg "<img src='{$root}/templates/icons/moon.png' alt = 'moon' title = 'Sweet dreams!'>"// After midnight
        
if ($hrs >  5$msg "<img src='{$root}/templates/icons/sunrise.png' alt = 'sunrise' title = 'Good morning!'>"// After 5am
        
if ($hrs >  10$msg "<img src='{$root}/templates/icons/sun.png' alt = 'sun' title = 'Have a good day!'>"// After 10am
        
if ($hrs 18$msg "<img src='{$root}/templates/icons/sunset.png' alt = 'sunset' title = 'Have a nice evening!'>"// After 6pm
        
if ($hrs 22$msg "<img src='{$root}/templates/icons/moon.png' alt = 'moon' title = 'Sweet dreams!'>"// After 10pm
        
$this->assign("timemsg",$msg); 
    } 
template.tpl:
Code:
   {include file="{$root}{$temp}{$theme}/header.tpl"}

<body>
<div id="wrapper">
<table cellspacing="3px" cellpadding="0px">
<tr><td colspan="2" id="image"><span><center><a href="{$path}index">{$site_name}</a></center></span></td></tr>
<tr><td id="timeofday">{$timemsg}</td><th colspan="2"><center>{$menu}</center></th></tr>
<tr><td id="menu">
<b><p><u>{$smarty.now|date_format:"%A, %B %e, %Y"}</u><br>
<font size='3'> &nbsp{$dot} {$smarty.now|date_format:"%I:%M %p"}</font></p></b>
{if $logged_in}
<br><br><br><br><p><b>You are logged in as:</b></p>
<a href="{$home}profile/view/{$username}"><font size="4"><b>{$username}</b></font></a>
<p>{$avatar}</p>
<br><p> &nbsp <font size="3">{$cash}</font> {$creditsicon} &nbsp &nbsp <font size="3">{$premium}</font> {$gemicon}</p><br>
<a href="{$home}messages">{$messages} Message(s)</a><br><br>
<a href="{$home}myadopts">My Pets</a>
<a href="{$home}inventory">Inventory</a><br><br>
<a href="{$home}pages/view/games">Games</a><br><br>
<a href="{$home}adopt">Adopt New Pets</a>
<a href="{$home}promo">Special Code</a><br><br>
<a href="{$home}login/logout">Log Out</a>
{if $isAdmin}<a href="{$home}admincp">Admin Control Panel</a>{/if}{/if}
<br><br>
{$sidebar}
<a href="{$home}online">{$online}</a><br><br>	 

</td><td id="content">
<h1>{$document_title}</h1>
<p>{$document_content}</p>

</td></tr>
<tr><td colspan="2" id="footer">{$footer}</td></tr>
</table>
</div>

</body>

</html>
Thanks ^_^
__________________
It's been a long time. I had so much fun making a site back in 2016 that recently, when I started thinking about it again, I decided to come back and work on something small. It'll probably just be a personal project but who knows? We'll see, anyway.

Reply With Quote