Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Which language should I use out of javascript or php?

Which language should I use out of javascript or php?

Scheduled Pinned Locked Moved Web Development
questionjavascriptphphtmlmysql
10 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_15952980
    wrote on last edited by
    #1

    Hi,

    It is my intention to build a site shop for a photographer but I have no idea which would be the next appropriate language to focus on learning to get the job done out of Javascript or PHP.

    What with other work commitments, I don't have the time to learn enough of both languages before the intended date of the site going live at the beginning of December.

    I'm hoping that if I give you an outline of the kind of functionality I want you will be able to point me in the appropriate direction:

    The photographer in question has a vast number of images they wish to sell as singles, or in sets of three for a reduced price in comparison to buying singles.

    The images will be displayed in categories, each of which has the potential to run into a number of pages.

    Customers are to be free to choose any image from any page of any category to make up their purchases.

    I don't currently want to build a login and members capacity so that session data (the selections made) can be stored and come back to at a later date.

    For now I want to be be able to allow customers to, on a single session basis, select as many images as they wish and then preview their selection prior to adding their final choice/s to a basket ready to check out.

    I also want to be able to ensure that if there is a session in which a customer previews their choice, sees they have eight images selected, for example, and want to choose one more - in order to benefit from the set of three price, that they can go back to continue shopping without loosing the selections they had made prior to going to the preview page.

    In terms of the shopping basket I cam across a paypal specific script that can be incorporated into html without the need to therefore build a php and mysql basket into the site.

    I anticipate that I will have to use radio buttons or check boxes for customers to be able to make their selections prior to previewing them. But is it possible, or feasible for a form to span all the category pages and their sub pages?

    Thanks in anticipation of you consideration and response

    L J 2 Replies Last reply
    0
    • M Member_15952980

      Hi,

      It is my intention to build a site shop for a photographer but I have no idea which would be the next appropriate language to focus on learning to get the job done out of Javascript or PHP.

      What with other work commitments, I don't have the time to learn enough of both languages before the intended date of the site going live at the beginning of December.

      I'm hoping that if I give you an outline of the kind of functionality I want you will be able to point me in the appropriate direction:

      The photographer in question has a vast number of images they wish to sell as singles, or in sets of three for a reduced price in comparison to buying singles.

      The images will be displayed in categories, each of which has the potential to run into a number of pages.

      Customers are to be free to choose any image from any page of any category to make up their purchases.

      I don't currently want to build a login and members capacity so that session data (the selections made) can be stored and come back to at a later date.

      For now I want to be be able to allow customers to, on a single session basis, select as many images as they wish and then preview their selection prior to adding their final choice/s to a basket ready to check out.

      I also want to be able to ensure that if there is a session in which a customer previews their choice, sees they have eight images selected, for example, and want to choose one more - in order to benefit from the set of three price, that they can go back to continue shopping without loosing the selections they had made prior to going to the preview page.

      In terms of the shopping basket I cam across a paypal specific script that can be incorporated into html without the need to therefore build a php and mysql basket into the site.

      I anticipate that I will have to use radio buttons or check boxes for customers to be able to make their selections prior to previewing them. But is it possible, or feasible for a form to span all the category pages and their sub pages?

      Thanks in anticipation of you consideration and response

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Member 15952980 wrote:

      to get the job done out of Javascript or PHP.

      You probably need both: PHP runs in the server to do the backend work, while Javascript runs in the browser to manage the actual presentation (and data capture, etc.) of the web page. You might be better looking into something like Wordpress which has many templates that you can adapt to your own needs.

      M 1 Reply Last reply
      0
      • L Lost User

        Member 15952980 wrote:

        to get the job done out of Javascript or PHP.

        You probably need both: PHP runs in the server to do the backend work, while Javascript runs in the browser to manage the actual presentation (and data capture, etc.) of the web page. You might be better looking into something like Wordpress which has many templates that you can adapt to your own needs.

        M Offline
        M Offline
        Member_15952980
        wrote on last edited by
        #3

        Thankyou Richard. Reguarding using Wordpress, I'm confident with HTML and CSS and was hoping to hand code the whole site to avoid generating lots of code I don't understand, and therefore wouldn't be able to debug more easily. Are you familiar with Wordpress? (I've never used it but know it is avaialable as part of the hosting package I purchased for a HTML site I built) If so do you envisage it being buggy within the context of the functionality I want?

        L 1 Reply Last reply
        0
        • M Member_15952980

          Thankyou Richard. Reguarding using Wordpress, I'm confident with HTML and CSS and was hoping to hand code the whole site to avoid generating lots of code I don't understand, and therefore wouldn't be able to debug more easily. Are you familiar with Wordpress? (I've never used it but know it is avaialable as part of the hosting package I purchased for a HTML site I built) If so do you envisage it being buggy within the context of the functionality I want?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Member 15952980 wrote:

          If so do you envisage it being buggy within the context of the functionality I want?

          I have not used Wordpress myself, but I know it is in wide use. As to whether it would be buggy, there is only one way to answer such a question.

          M 1 Reply Last reply
          0
          • L Lost User

            Member 15952980 wrote:

            If so do you envisage it being buggy within the context of the functionality I want?

            I have not used Wordpress myself, but I know it is in wide use. As to whether it would be buggy, there is only one way to answer such a question.

            M Offline
            M Offline
            Member_15952980
            wrote on last edited by
            #5

            Fair point. It may well be my best bet for now given the timeframe I have to work to.

            1 Reply Last reply
            0
            • M Member_15952980

              Hi,

              It is my intention to build a site shop for a photographer but I have no idea which would be the next appropriate language to focus on learning to get the job done out of Javascript or PHP.

              What with other work commitments, I don't have the time to learn enough of both languages before the intended date of the site going live at the beginning of December.

              I'm hoping that if I give you an outline of the kind of functionality I want you will be able to point me in the appropriate direction:

              The photographer in question has a vast number of images they wish to sell as singles, or in sets of three for a reduced price in comparison to buying singles.

              The images will be displayed in categories, each of which has the potential to run into a number of pages.

              Customers are to be free to choose any image from any page of any category to make up their purchases.

              I don't currently want to build a login and members capacity so that session data (the selections made) can be stored and come back to at a later date.

              For now I want to be be able to allow customers to, on a single session basis, select as many images as they wish and then preview their selection prior to adding their final choice/s to a basket ready to check out.

              I also want to be able to ensure that if there is a session in which a customer previews their choice, sees they have eight images selected, for example, and want to choose one more - in order to benefit from the set of three price, that they can go back to continue shopping without loosing the selections they had made prior to going to the preview page.

              In terms of the shopping basket I cam across a paypal specific script that can be incorporated into html without the need to therefore build a php and mysql basket into the site.

              I anticipate that I will have to use radio buttons or check boxes for customers to be able to make their selections prior to previewing them. But is it possible, or feasible for a form to span all the category pages and their sub pages?

              Thanks in anticipation of you consideration and response

              J Offline
              J Offline
              Jeremy Falcon
              wrote on last edited by
              #6

              Given the choice between JavaScript and PHP, master JavsScript and also use Node for the backend work. It'll take you further these days.

              Jeremy Falcon

              M 1 Reply Last reply
              0
              • J Jeremy Falcon

                Given the choice between JavaScript and PHP, master JavsScript and also use Node for the backend work. It'll take you further these days.

                Jeremy Falcon

                M Offline
                M Offline
                Member_15952980
                wrote on last edited by
                #7

                Thanks for insight. I've never heard of Node before and just read a basic introduction about what it can do on W3 schools... I notice that Node work in partnership with mysql as php does. Mysql is my intended progression after php or Node.js So does using Node mean you can skip learing php altogether? Also, considering it is javascript based, are the server side scripts run entirely on the server as with php? Or are there client and server security concerns that put using it at disadvantage compared to using an entirely server side language such as php?

                J 1 Reply Last reply
                0
                • M Member_15952980

                  Thanks for insight. I've never heard of Node before and just read a basic introduction about what it can do on W3 schools... I notice that Node work in partnership with mysql as php does. Mysql is my intended progression after php or Node.js So does using Node mean you can skip learing php altogether? Also, considering it is javascript based, are the server side scripts run entirely on the server as with php? Or are there client and server security concerns that put using it at disadvantage compared to using an entirely server side language such as php?

                  J Offline
                  J Offline
                  Jeremy Falcon
                  wrote on last edited by
                  #8

                  Member 15952980 wrote:

                  So does using Node mean you can skip learing php altogether?

                  Yes

                  Member 15952980 wrote:

                  Also, considering it is javascript based, are the server side scripts run entirely on the server as with php?

                  Yes. One of the main advantages to Node too, is that you can have what's called an isomorphic application. Which is a fancy of way of saying you can run the same code on both the client and server. Stuff that accesses the DOM will be client only, but for algorithmic type routines it's the same code.

                  Member 15952980 wrote:

                  Or are there client and server security concerns that put using it at disadvantage compared to using an entirely server side language such as php?

                  No security concerns that PHP wouldn't also suffer. The main considerations are performance and available libraries. Google has put a lot of work into V8 (the JS engine Node is built on), so it's not nearly as slow as people would think. PHP can pre-compile into bytecode to speed up parsing prior to execution, but V8 also JITs in real time to native code in memory. Don't get me wrong, V8 will never be as fast as C/C++ or Rust and it's single threaded. But when compared to things like PHP, it does pretty well. [PHP vs Node js - Which programs are fastest?](https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/php.html) PHP has a ton of built in functionality, like say for editing PDF files. Node doesn't. Fortunately, the community is huge for Node so finding a package to do most stuff is rarely a problem. In fact, it's so huge the real problem will be knowing which packages to avoid. I say this as a dude who used to love PHP. I'll always have a fond soft spot for it, but times change.

                  Jeremy Falcon

                  M 1 Reply Last reply
                  0
                  • J Jeremy Falcon

                    Member 15952980 wrote:

                    So does using Node mean you can skip learing php altogether?

                    Yes

                    Member 15952980 wrote:

                    Also, considering it is javascript based, are the server side scripts run entirely on the server as with php?

                    Yes. One of the main advantages to Node too, is that you can have what's called an isomorphic application. Which is a fancy of way of saying you can run the same code on both the client and server. Stuff that accesses the DOM will be client only, but for algorithmic type routines it's the same code.

                    Member 15952980 wrote:

                    Or are there client and server security concerns that put using it at disadvantage compared to using an entirely server side language such as php?

                    No security concerns that PHP wouldn't also suffer. The main considerations are performance and available libraries. Google has put a lot of work into V8 (the JS engine Node is built on), so it's not nearly as slow as people would think. PHP can pre-compile into bytecode to speed up parsing prior to execution, but V8 also JITs in real time to native code in memory. Don't get me wrong, V8 will never be as fast as C/C++ or Rust and it's single threaded. But when compared to things like PHP, it does pretty well. [PHP vs Node js - Which programs are fastest?](https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/php.html) PHP has a ton of built in functionality, like say for editing PDF files. Node doesn't. Fortunately, the community is huge for Node so finding a package to do most stuff is rarely a problem. In fact, it's so huge the real problem will be knowing which packages to avoid. I say this as a dude who used to love PHP. I'll always have a fond soft spot for it, but times change.

                    Jeremy Falcon

                    M Offline
                    M Offline
                    Member_15952980
                    wrote on last edited by
                    #9

                    Thank you very much Jeremy for taking the time to answer my questions and concerns. I did do a course on PHP years ago, just before the laucnch of Node.js, and figured it would be easiest to just go back to learning that from scratch. But as you say times change. You mention that PHP has a ton of functionality that Node doesn't.... My limited knowledge of php did leave me wanting to go forwards with certain capabilities. In a personal capacity I would like to build a music database. Would I be able to use Node, in conjuntion with mysql to: - make directories (to, for example, store uploaded mp3 files) - make pages (to, for example, print html code to make a html document) Thanks in advance for your consideration

                    J 1 Reply Last reply
                    0
                    • M Member_15952980

                      Thank you very much Jeremy for taking the time to answer my questions and concerns. I did do a course on PHP years ago, just before the laucnch of Node.js, and figured it would be easiest to just go back to learning that from scratch. But as you say times change. You mention that PHP has a ton of functionality that Node doesn't.... My limited knowledge of php did leave me wanting to go forwards with certain capabilities. In a personal capacity I would like to build a music database. Would I be able to use Node, in conjuntion with mysql to: - make directories (to, for example, store uploaded mp3 files) - make pages (to, for example, print html code to make a html document) Thanks in advance for your consideration

                      J Offline
                      J Offline
                      Jeremy Falcon
                      wrote on last edited by
                      #10

                      You'll be just fine in Node. It offers a bunch of modules to access things like the file system... on the server side. And there are plenty of ways to connect to a DB such as MySQL.

                      Jeremy Falcon

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups