Post by Ion_Cannon » Wed Feb 16, 2011 10:16 am

OK. I am a noob first off but I know enough PHP to be dangerous. I am trying to learn OpenCart's layout. I am trying to create a button that will simply Delete data from a table in the database. I have the button displaying fine and I call it with a <a onclick="mynewfunction();">My Button</a> I added mynewfunction() to the model file that performs the action on the table and field in the database but I am getting an unexpected T_PUBLIC" error when I add the function. Can someone give me a brief explanation of how buttons work in OpenCart? Just a real simple example would be excellent.

thanks all.

New member

Posts

Joined
Fri Jan 28, 2011 11:11 am

Post by Ion_Cannon » Thu Feb 17, 2011 9:20 pm

Anyone?

New member

Posts

Joined
Fri Jan 28, 2011 11:11 am

Post by Qphoria » Thu Feb 17, 2011 10:26 pm

well first you are adding a javascript tag and expecting it to fire a php function? That won't happen unless you have the ajax code to bridge the gap.

Unexpected T_PUBLIC means you tried to add a public function to a php file but not in the right place. If you are inside of a class you can use "public function blah()" but if you are outside a class you just use "function blah()"

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Ion_Cannon » Fri Feb 18, 2011 6:24 am

Qphoria wrote:well first you are adding a javascript tag and expecting it to fire a php function? That won't happen unless you have the ajax code to bridge the gap.

Unexpected T_PUBLIC means you tried to add a public function to a php file but not in the right place. If you are inside of a class you can use "public function blah()" but if you are outside a class you just use "function blah()"
Thanks Qphoria, I understand. Appreciate it.

New member

Posts

Joined
Fri Jan 28, 2011 11:11 am
Who is online

Users browsing this forum: No registered users and 123 guests