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.
|
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.
|
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;
|
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" |
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
|
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 04:36 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.