Page 1 of 1
user libraries: one or two?
Posted: Thu Jul 28, 2005 12:55 pm
by php12342005
in php, we have to use javascript functions, normally, user libraries make things easier.
but, do you have two different kinds of libraries: php library and javascript library, or just one?
if two, some functions in both libraries look very similar.
in my case, I created two, but when I modify one, I have to modify another one.
i.e. function checkEmail(..) is in both user libraries.
if one, how do you mix code? I can not think about it.
thanks
Posted: Thu Jul 28, 2005 1:06 pm
by timvw
It's impossible to mix them.
PHP is executed at the server to generate html and eventual Javascript code...
Then the results of that are passed to the client.. Which executes the Javascript..
Posted: Thu Jul 28, 2005 1:15 pm
by josh
What about a php library that outputs javascript code.
So you can write a function with the following syntax in php:
Code: Select all
update_form_field(form_name, form_element)
Then have that function output whatever javascript youre using to update form fields.
Posted: Thu Jul 28, 2005 1:21 pm
by Chris Corbyn
jshpro2 wrote:What about a php library that outputs javascript code.
So you can write a function with the following syntax in php:
Code: Select all
update_form_field(form_name, form_element)
Then have that function output whatever javascript youre using to update form fields.
I guess someone could (or maybe even has) write a class for that (form classes with JS validation included would be nice). Not something worth building into PHP though...
Posted: Thu Jul 28, 2005 1:25 pm
by josh
d11wtq wrote:jshpro2 wrote:What about a php library that outputs javascript code.
So you can write a function with the following syntax in php:
Code: Select all
update_form_field(form_name, form_element)
Then have that function output whatever javascript youre using to update form fields.
I guess someone could (or maybe even has) write a class for that (form classes with JS validation included would be nice). Not something worth building into PHP though...
I didn't mean building it into PHP, I mean a class or a list of custom functions if he's not into OOP