RoseCamp 0 Posted June 22, 2007 I am new to coding in PHP and have recently implemented an online store based on osCommerce. There is lots of great code to copy and/or learn from. There are a couple of things that I can't find any info about on the PHP sites or elsewhere.... First thing: The symbol -> is used in various places. It seems to be used to append something to an existing variable. eg. in \includes\functions\general.php, about line 1033... $message->build_message(); $message->send($to_name, $to_email_address etc) Can anyone provide a link to an explanation of the -> symbol, just so I can confirm my assumption /and so I can figure out how I can't find a description for it? Second query: the send() in the above code example. I can't find an explanation of that either. I've searched my osCommerce source code, it doesn't seem to be a osCommerce function. .. Thanks Rose Share this post Link to post Share on other sites
Jack_mcs 792 Posted June 22, 2007 The $message variable represents an instance of a class. Send is a function in that class. The -> tells the code to look in the $message class and execute the function named send. If you look in includes/classes/message_stack.php, it might make more sense. Jack Support Links: Need Help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC version (the community-supported responsive version) here. How to Upgrade to the latest version Recommended SEO Addons Share this post Link to post Share on other sites
RoseCamp 0 Posted June 22, 2007 Thanks Jack. That has cleared it up a bit for me, but I still can't find the definition for the class message. I have found class messagestack, but I wouldn't have thought that was the same thing. I finally found the definition for the send function too. Don't know how I missed it first time. So where is the $message class defined? or is it assumed, and the -> just tells it to go look for the send function? I have finally found a bit of info in the PHP manual, thanks to your description. http://www.php.net/manual/en/functions.var...e-functions.php Perhaps I just need to ponder on that for a bit. Rose Share this post Link to post Share on other sites
Jack_mcs 792 Posted June 22, 2007 It is created in includes/application top: $messageStack = new messageStack; Jack Support Links: Need Help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC version (the community-supported responsive version) here. How to Upgrade to the latest version Recommended SEO Addons Share this post Link to post Share on other sites
RoseCamp 0 Posted June 22, 2007 It's hard not to feel stupid... but I will ask the question! Why is $messageStack the same as $message? I would have thought that $message->send() was looking for a variable called $messageStack, not $message? Rose Share this post Link to post Share on other sites
Jack_mcs 792 Posted June 22, 2007 It's not the same. I didn't pay enough attention to your original post. The $message or $messageStack or $anynameyouwant is an instance of whatever class it is created from using the new operator. You mentioned that $message was in the general.php file. So if you look in the function where it is used (assuming we are referring to the same code), you will see $message = new email(array('X-Mailer: osCommerce Mailer')); Jack Support Links: Need Help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC version (the community-supported responsive version) here. How to Upgrade to the latest version Recommended SEO Addons Share this post Link to post Share on other sites