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)
-   -   Put "FavPet" in a Smarty template based sidebar? (http://www.mysidiaadoptables.com/forum/showthread.php?t=5304)

bisexuowl 12-19-2016 07:07 PM

Put "FavPet" in a Smarty template based sidebar?
 
so i'm designing my own theme and so far it's been really fun! however, i have realized i have no clue how to grab the favpet id from the database to assign it in the class_template.php. i've tried just "$this->assign("favpet",$mysidia->user->profile->favpet)", i've tried "$favpet = mysql_query("SELECT 'favpet' FROM 'aetherwisps_1'.'aw1_users_profile' WHERE 'uid' = '{$uid}'");", and i think i tried one more thing but i don't remember.

Hall of Famer 12-19-2016 07:52 PM

Well first of all, never use mysql_query. Its been considered a terrible practice being procedural, insecure and outdated. Latest PHP versions already remove mysql_ functions, you should use $mysidia->db for Mysidia Adoptables. Or alternatively, try PDO if you dont want to use $mysidia->db or do not have access to it.

bisexuowl 12-19-2016 08:30 PM

at the risk of sounding silly, how do i use $mysidia->db properly? i was new to coding a few months ago and took a break and now i'm totally lost again ;n;

Dinocanid 12-19-2016 08:54 PM

This guide has a section on how to use it:
https://docs.google.com/document/d/1...=h.7kcho2wxopx
It's the part that says "database sql statements"

bisexuowl 12-19-2016 09:29 PM

thanks for the help! i think i'm on the right track now, i've gotten it to half work and i think i can figure out the rest. :3

Hall of Famer 12-20-2016 08:30 AM

Note you may not be able to use $mysidia->db directly in a template .tpl file, it is available in any PHP files by calling $mysidia = Registry::get("mysidia"); You may want to fetch all favorite pets data from database, assign them as array or other collection types in smarty template, and then use the collection in smarty template.


All times are GMT -5. The time now is 09:15 AM.

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