Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

I have about had it! I need some help

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 05-23-2007, 05:15 PM
 
hhiker hhiker is offline
 

eXpert
  
Join Date: May 2007
Posts: 231
 

Default 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
__________________
-
-
Versions: 4.1.10 and 4.3.0 (see post for which cart)

"Until man duplicates a blade of grass, nature can laugh at his so-called scientific knowledge." - Thomas Edison

"Never doubt that a small group of thoughtful, committed citizens can change the world; indeed, it is the only thing that ever has." - Margaret Mead (1901-197 quoted in John M. RIchardson, ed. Making it Happen, 1982

"Water is the best of all things." - Pindar (c. 522 BC - c. 438 BC), Olympian Odes
Reply With Quote
  #2  
Old 05-23-2007, 07:08 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default 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.
Reply With Quote
  #3  
Old 05-24-2007, 09:59 AM
 
hhiker hhiker is offline
 

eXpert
  
Join Date: May 2007
Posts: 231
 

Default 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.
__________________
-
-
Versions: 4.1.10 and 4.3.0 (see post for which cart)

"Until man duplicates a blade of grass, nature can laugh at his so-called scientific knowledge." - Thomas Edison

"Never doubt that a small group of thoughtful, committed citizens can change the world; indeed, it is the only thing that ever has." - Margaret Mead (1901-197 quoted in John M. RIchardson, ed. Making it Happen, 1982

"Water is the best of all things." - Pindar (c. 522 BC - c. 438 BC), Olympian Odes
Reply With Quote
  #4  
Old 05-24-2007, 10:05 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default 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}.
Reply With Quote
  #5  
Old 05-24-2007, 11:10 AM
 
hhiker hhiker is offline
 

eXpert
  
Join Date: May 2007
Posts: 231
 

Default 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
__________________
-
-
Versions: 4.1.10 and 4.3.0 (see post for which cart)

"Until man duplicates a blade of grass, nature can laugh at his so-called scientific knowledge." - Thomas Edison

"Never doubt that a small group of thoughtful, committed citizens can change the world; indeed, it is the only thing that ever has." - Margaret Mead (1901-197 quoted in John M. RIchardson, ed. Making it Happen, 1982

"Water is the best of all things." - Pindar (c. 522 BC - c. 438 BC), Olympian Odes
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:23 PM.

   

 
X-Cart forums © 2001-2020