PDA

View Full Version : Php + ....


darelf
04-05-2004, 08:41 AM
Sigh. I fell for the "PHP + JavaScript is so cool!" line and then tried it out. While the *effects* are cool, it is such a pain having two different languages in the page and trying to remember that you're debugging one or the other......

I just recoded everything back into PHP only and am finishing the project that way... but....

Has anyone had any *good* experiences with PHP + JS? or PHP + ???

gold_dragon
04-06-2004, 03:13 PM
I have, I thought it was kind of neat. Except the fact that I had to have the JS in the PHP brackets so I thought it looked kind of dirtly.

skidooer
04-07-2004, 10:09 PM
Put HTML in templates (use a templating system like Smarty), JavaScript in external files, and PHP in PHP files and you'll never confuse any of them again.

gold_dragon
04-07-2004, 10:27 PM
Originally posted by skidooer
Put HTML in templates (use a templating system like Smarty), JavaScript in external files, and PHP in PHP files and you'll never confuse any of them again. Yeah, but what if you wish to work JavaScript from a MySQL database.

I forget the reason why I needed to do this, yeah, it was for opening a new window. Anyway, that is one reason.

If you aren't talking about that then I haven't had any problems with client side JavaScripting and PHP together. I don't see why there would be a problem. Unless you have problems with Syntax. You can break out of PHP for HTML and Javascript. Novice print out HTML instead of breaking out of PHP for HTML. Takes too long to not do so.

stuka
04-08-2004, 11:12 AM
gold_dragon: from the point of view of maintainability, the splitting up is the best way to manage it. Also, I don't think there's any need to have the javascript inside the PHP as such - proper use of arguments to functions should allow you to handle all of that from a properly segregated system.

darelf
04-08-2004, 03:19 PM
Well, of course there's a database involved.... why mess with it otherwise? So passing information from the database through PHP to JavaScript for dynamic client use turned out to be more pain and trouble than just re-designing the thing to work on forms and PHP alone.

gold_dragon
04-08-2004, 06:09 PM
Originally posted by darelf
Well, of course there's a database involved.... why mess with it otherwise? So passing information from the database through PHP to JavaScript for dynamic client use turned out to be more pain and trouble than just re-designing the thing to work on forms and PHP alone. I think I did that since I can't think of any reason why you would need JavaScript to see data in a database. Be nice if I still had the snippet.

darelf
04-13-2004, 10:46 AM
Yeah, basically the user picks things from a list... a list that exists in the database. So two listboxes and some javascript... voila!

Bah, just using a multiple select now.... cleaner...

gold_dragon
04-13-2004, 04:04 PM
Originally posted by darelf
Yeah, basically the user picks things from a list... a list that exists in the database. So two listboxes and some javascript... voila!

Bah, just using a multiple select now.... cleaner... I was thinking about creating a javascript variable using PHP but I don't really see a point to do it. You can workaround it and have cleaner code.