user libraries: one or two?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
php12342005
Forum Commoner
Posts: 79
Joined: Mon Mar 21, 2005 3:35 am

user libraries: one or two?

Post 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
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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..
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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...
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post 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
Post Reply