Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-17-2014, 02:47 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 91,097
Kyttias is on a distinguished road
Default Smarty and Conditional Templating~?

So I've been reading through Smarty documentation, since Mysidia is built using that templating system.

The documentation suggests we can do things such as the following in our template (.tpl) files:

PHP Code:
{if $logged_in}
Welcome, {$username}!
{else}
Please log in or sign up~
{/if} 
That's pretty neat, and conditional templating sounds fun, considering there are large portions of my menu I'd rather not display to users not signed in. Currently a $logged_in variable by that name does not exist, so only the else statement will ever appear, and I was hoping {$mysidia->user->isloggedin} and {$mysidia->user->username} would work but those are not accessible outside their scope, and, honestly, why isn't Registry::get("mysidia"); on a global scope? They're accessible in the sidebar.

My complaint with the sidebar usage is that... well... I want more freedom than that? I want to place it in anywhere in my template (.tpl) and not have to mess with deep Mysidia files every time I want to place my user's name or currency amount. If I want to display any variable on this site, I want to make full use of the Smarty templating. I think some considerations for the next version of Mysidia should be made in regards to variables accessible to us from any page, any where, any time.

In short -
Where can I/should I/do I position Registry::get("mysidia"); to make its usage global?
How do I go about shortening {$mysidia->user->username} to {$username}, {$mysidia->user->isloggedin} to {$logged_in}, and {$mysidia->user->money} {$mysidia->settings->cost} to {$currency}?

~ <3

Last edited by Kyttias; 06-17-2014 at 03:26 PM.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Smarty Tips: Things you can do with Templates Kyttias Tutorials and Tips 5 04-03-2015 10:53 AM
Assigning array to smarty variables IntoRain Questions and Supports 3 06-03-2014 02:06 PM
Smarty errors and WAMPP Kesstryl Questions and Supports 15 01-29-2014 09:07 PM
Problem: smarty class 1.3.4 draugluin Questions and Supports 8 11-15-2013 02:29 AM


All times are GMT -5. The time now is 08:27 AM.

Currently Active Users: 286 (0 members and 286 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636