RetouchPRO

Go Back   RetouchPRO > Business > Your Website
Register Blogs FAQ Site Nav Search Today's Posts Mark Forums Read


Your Website Questions and (hopefully) answers about setting up your own business or gallery website

Java & PHP

Reply
 
Thread Tools
  #1  
Old 01-16-2003, 03:36 PM
jeaniesa's Avatar
jeaniesa jeaniesa is offline
Senior Member
 
Join Date: Aug 2001
Location: Colorado foothills
Posts: 1,826
JavaScript & PHP

Quote below from this post:
Quote:
Originally posted by d_kendal
the advantage to PHP (and the reason I'm learning it before I get into Javascript much) is that it's a server side language meaning that all the scripts you write run on the server then display as an HTML page for any browser eliminating the possibility of browser compatibility (which can definitely be a problem with java, the menu bar here is an example, a lot of people had problems with it, but as long as people keep their browsers updated it's generally not a problem) the other advantage to it is that your code is kept hidden since it only runs on the server and your page is output in HTML, where with javascript, your code is right there to anybody who decides to do a "View source". ASP is the same idea, but I prefer to go with the open source stuff and from what I've seen and learned so far, I like PHP better anyway.
Thanks for that info David. (I've broken this discussion off to create a new thread so I can ask more questions without going to far out on a tangent in the other thread.)

I've been a little worried about Java b/c of the browser issues, but then I wonder whether that worry is misplaced because every site that I've looked at for ideas on how to implement my own site has extensive Java script! (And I've looked at a lot!) Plus, it seems that both ImageReady and Dreamweaver automatically put out Java scripts for such things as rollovers, etc. That allows me to just tweak the code that's created rather than have to start from scratch. I know enough about programming languages to figure out what's going on and copy syntax without having to actually learn a whole new language.

So, can PHP code create rollover effects like Java? Can it do basically anything Java can - without the browser imcompatibility issues? I guess most importantly, can it be worked in "after the fact"? Meaning, if I design my website using Java now (the path of least resistance a the moment) and decide later that I would prefer it to be implemented with PHP, can I work that in or would it necessitate me starting from scratch with my web design?

Sorry for all of these questions.

Jeanie

Last edited by jeaniesa; 01-16-2003 at 08:50 PM.
Reply With Quote top
  #2  
Old 01-16-2003, 03:56 PM
Doug Nelson's Avatar
Doug Nelson Doug Nelson is offline
Janitor
 
Join Date: Aug 2001
Posts: 7,068
Blog Entries: 21
PHP and Javascript (really what we're talking about here) are really for different purposes. PHP is for dynamically making page content (pre-hypertext-processing). Javascript is for controlling your browser. Not that they can't overlap.

For example, the page you're reading right now is generated by PHP. The navbar over on the left is Javascript, as are the little windows that popup when replying to a message so you can insert smilies or formatted text.
Reply With Quote top
  #3  
Old 01-16-2003, 03:56 PM
Leah's Avatar
Leah Leah is offline
Senior Member
 
Join Date: Aug 2002
Location: London, UK
Posts: 518
Jeanie, Do you mean Java or JavaScript?
Reply With Quote top
  #4  
Old 01-16-2003, 04:30 PM
Leah's Avatar
Leah Leah is offline
Senior Member
 
Join Date: Aug 2002
Location: London, UK
Posts: 518
Assuming that you mean JavaScript, Doug has given a pretty good summary.

Server-side scripting (as with PHP or ASP) enables you to create dynamic content that is transparent to the browser client.

Some stuff you can do in either JavaScript or PHP/ASP:

For example, imagine you want your page to recognise (e.g. from a cookie) what the user's name is and say "Good morning" or "Good afternoon" based on the time.

If you do this using a client-side script (e.g. client side JavaScript) you can easily get the page to read a cookie, find out that the visitor's name is Fred, check the current time, work out if it is morning or afternoon, and display "Good afternoon, Fred" on the screen - but if Fred views the source for the page he will be able to see all your JavaScript code.

You can also do it using a server-side script (e.g. server-side PHP or ASP) - the logic will be pretty much the same BUT the processing is all done on the server BEFORE the page is sent to the client browser. So the screen will say "Good afternoon, Fred" AND if Fred views the source all he'll see is standard HTML saying "Good afternoon, Fred" as if you'd manually hard-coded it in that way in an .html file.

For some purposes, it doesn't really matter which option you go for - for others, you might want to keep your logic hidden from the browser for sound business reasons or just to preserve an air of mystique...

Some other stuff you'd really want to use PHP/ASP for:

For example (this is the big one) any time you want to query or update a database.

Other stuff you'd want to use JavaScript (or something else like dynamic HTML) for:

For example, rollover buttons, special layout and presentation effects.

Also verifying fields on a form - if you do that server-side you have to have the completed form sent to you, process the verification on the server, and then return the page with errors flagged up so that the user can resubmit it, you can recheck it, as like as not you rereturn it with the remaining errors flagged up so that the user can reresubmit it... can be a lengthy process. If you do it client-side the form never actually gets submitted until the JavaScript running on the client machine has checked that the form's been filled in OK, so all you get is one actual submission of the form to the server.

General

It's a case of horses for courses. Many pages will include some client-side and some server-side scripting. Plus of course you can embed client-side scripting inside server-side scripting so that you dynamically decide on the server which bits of JavaScript you want to include in the page... but at that point I generally have to go and lie down in a darkened room for a while.

As a side issue - client-side scripting has cross-browser compatability issues (although these aren't generally as bad as you think) but can be run from any server, while server-side scripting has server compatability issues - if you plan to script in PHP or ASP you need to make sure that your site is being hosted on a server that supports it. Some hosting companies will charge extra for packages that include support for server-side scripting.

And now I think my darkened room awaits...
Reply With Quote top
  #5  
Old 01-16-2003, 08:59 PM
jeaniesa's Avatar
jeaniesa jeaniesa is offline
Senior Member
 
Join Date: Aug 2001
Location: Colorado foothills
Posts: 1,826
Yes, I meant JavaScript. Sorry! Once upon a time long, long ago I knew (really, I did!) that Java and JavaScript were two different beasts. (Doug, feel free to edit the subject of the thread to reflect that.)

Thanks so much for the overview Doug & (esp.) Leah. Seems like I knew all of this at one time, but conveniently forgot! (E.g., I knew that PHP was useful for querying databases and displaying the results.) Good thing I've got four days of vacation this weekend - I need to get rid of the clutter in my brain! (Leah, I'll keep the darkened room idea for when I return - that may be the best piece of advice yet! )

Jeanie
Reply With Quote top
  #6  
Old 01-17-2003, 04:01 AM
d_kendal's Avatar
d_kendal d_kendal is offline
Senior Member
 
Join Date: Feb 2002
Location: Edmonton, Alberta, Canada
Posts: 829
Excellent overview Leah, I hadn't heard or read about the forms issue with server side languages, so thanks for that tip.
Jeanie - JavaScript and PHP or ASP are kind of hard to compare, since they both have they're own advantages and are very different types of languages. for rollovers as an example, there's no PHP or ASP scripts for that as far as I know, you're best to stick to Javascript or Flash (which is also excellent for rollovers) but for things like dynamic content, the server side languages are far better.
OOps, I confused the matter in my original post when I said java and meant javascript, sorry, I went back and edited it. oh, and it's best to do research and decide which one you want to use before doing a lot of work on a site as it can be a lot of pain to change over. using PHP / ASP can be a big advantage for site management since you can set it up so that you can make changes to the look of the entire site without painfully going through each html page because of the fact that it's dynamic content. sorry if I'm not making sense, my brain is tired, too much reading, thinking, and getting confused about coding, I'm going to sleep now!!

- David
Reply With Quote top
  #7  
Old 01-17-2003, 10:00 AM
winwintoo's Avatar
winwintoo winwintoo is offline
Senior Member
 
Join Date: Feb 2002
Location: Regina, Saskatchewan
Posts: 942
Thanks for starting this thread...

For a variety of reasons, I haven't been doing any photo work for a while and most recently, I've been boning up on HTML, Javascript etc to develop a web site for my son's business and I was wishing for a "RetouchPro" sort of forum where I could ask my newbie HTML questions.

How great it is to find among my old friends people who are going down the same path.

BTW - I'm putting my PhotoShop learning to good use in developing graphics for the site.

Thanks again for the discussion,

Take care, Margaret
Reply With Quote top
  #8  
Old 01-18-2003, 06:11 AM
dcarr dcarr is offline
Senior Member
 
Join Date: Jul 2002
Location: Glendale, New York
Posts: 282
For David and all interested in PHP. I don't know if you have this site, but I came across it on my wanderings:

http://www.hotscripts.com/Detailed/3718.html
It supposedly answers questions you haven't even thought of yet. Hope it helps someone.
Debbie
Reply With Quote top
  #9  
Old 01-18-2003, 05:00 PM
d_kendal's Avatar
d_kendal d_kendal is offline
Senior Member
 
Join Date: Feb 2002
Location: Edmonton, Alberta, Canada
Posts: 829
Thanks for the link Debbie, I hadn't found the site, even though I have looked around HotScripts quite a bit (that's where I found an excellent tutorial on loading PHP, MySQL and Apache on your own computer to act like a server to test out and develop a website before you actually have some real webserver space). looks like a good place to find answers to questions I have since I'm learning the language.

- David
Reply With Quote top
Reply

  RetouchPRO > Business > Your Website


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Development and Support csundar Classifieds 0 11-24-2006 05:36 AM
Java Class Files ??? Cameraken Software 16 10-31-2005 08:20 PM
PHP?? (HTML preprocessor) winwintoo Your Website 4 04-08-2003 08:36 PM
3D Java interface to Google Doug Nelson Salon 3 03-05-2003 11:51 PM
resizing for a table clare Your Website 16 02-24-2003 03:15 PM


All times are GMT -6. The time now is 07:22 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
Copyright © 2016 Doug Nelson. All Rights Reserved