![]() |
I have about had it! I need some help
I am working on our company site and am about to pull my hair out over here. The boss does not understand that this can not be built in an hour so I am pushing through as fast as I can. Well, I have hit a road block on a few things and don't know which way to go.
I am lost in the template files. I have read through the basic files to edit thread and a ton of other threads, testing code & modifying where need be. My biggest road block is that I do not know all of these smarty code call functions (or whatever they are called). The ones that look like {$imagedir}. Where is it I can find a list of this stuff? Is there a list? Also, I am going through the smarty manual on smarty.php.net but it just gives code examples. There are no pictures showing what the visual output of doing this stuff is. Other than the one book published on Smarty and the online documentation, does anyone know of a site that has the "do this code & this is your output" with pictures? Yes, I am a visual learner. I think I just need a break from this site & a stiff drink. Thanks in advance for any suggestions. I just feel like I am in the middle of the ocean and can not find even an island to land on. Jen |
Re: I have about had it! I need some help
The learning curve is most definitely steep, and will take place over a period of time - certainly not an hour - so your feelings are normal and just :)
The smarty manual gives the best examples of what the code does with outputs - though not x-cart specific - unfortunately with variables, x-cart uses hundreds if not thousands of them, and it is not possible or necessary to list the function of them all. The best way I've found to learn, is to know what you want to do, and then figure out the variables and code necessary to do it. In the process, you will gain knowledge that will help you in all areas. Good luck. |
Re: I have about had it! I need some help
Jon,
Thank you so much for your reassurance that this really takes time to learn where everything is and how it works. I was really starting to get overwhelmed last night. I think where I am stuck after reading the Smarty manual last night and sleeping on it is this. It says to define your variables like CustomerName should be defined as John Doe. Great. I have defined it as John Doe. So now when I put in {$CustomerName} it will always pull John Doe as the customer name no matter who the customer really is. I know this info is stored in cookies and in the database (if the customer is logged in of course) but how does Smarty draw from the database? Is that not smarty? I know php draws from the database and know how it functions. Do you see the gap I can not seem to fill? PS. We are signed up for your eZine & you sell several mods we are looking at purchasing over time. :grin: |
Re: I have about had it! I need some help
Think of it as a heirarchy:
MYSQL DATABASE - PHP -- SMARTY --- HTML BROWSER When you want information from the database, you query it from the database in php, then you pass it to the smarty templates, which are rendered to display html in the browser. So if you want a CustomerName variable, in your php file you use: Code:
$CustomerName = func_query_first_cell("SELECT firstname FROM $sql_tbl['customers'] WHERE login='$login'"); The $login variable is unique for each person who is logged in to your site, so php uses this unique variable to query the persons actual name. The func_query_first_cell is a built in x-cart function to query one cell from a record. Other common query calls include "func_query_first (get one record)" and "func_query (get multiple records)". You then need to pass the variable to smarty, which is done in php with: Code:
$smarty->assign("CustomerName",$CustomerName); In your smarty templates, you can then use: Code:
Hello {$CustomerName}. |
Re: I have about had it! I need some help
Jon!!!
You are wonderful. I read that manual a couple times last night and it made no sense. What you just said makes perfect sense. Thank you so much! Jen |
All times are GMT -8. The time now is 09:36 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.