Jump to content

Recommended Posts

Hi everybody! I want want to know what is the best form to create unobtrusive PHP/Javascript, if it is possible. I mean, it is possible to completely separate them and make a neat and tidy code?

 

Any guidance would be appreciated... book, technique, keyword.

 

Txs.

 

It depends on what you mean by 'completely separate.'  In many cases, it will make sense for PHP to write the HTML document as output.  This often includes incorporating JavaScript library code and writing JavaScript code pertaining to that particular page in script tags.

 

Your best bet would be to use a MVC design pattern where you can separate request processing and all of the business a site is required to do from displaying the views of the site itself (the visible stuff that the end user interacts with).  The views would most likely be HTML templates in a PHP file so they could grab and display the results from the request processing.

 

So, look up MVC.  And, if you're comfortable with OOP, front controller.

Hi everybody! I want want to know what is the best form to create unobtrusive PHP/Javascript, if it is possible. I mean, it is possible to completely separate them and make a neat and tidy code?

 

Any guidance would be appreciated... book, technique, keyword.

 

Txs.

 

It depends on what you mean by 'completely separate.'  In many cases, it will make sense for PHP to write the HTML document as output.  This often includes incorporating JavaScript library code and writing JavaScript code pertaining to that particular page in script tags.

 

Your best bet would be to use a MVC design pattern where you can separate request processing and all of the business a site is required to do from displaying the views of the site itself (the visible stuff that the end user interacts with).  The views would most likely be HTML templates in a PHP file so they could grab and display the results from the request processing.

 

So, look up MVC.  And, if you're comfortable with OOP, front controller.

 

 

Txs for your reply Nightslyr... I'm really a newbee and sometime I'm afraid I don't speak the correct jargons but you got my message. I will look into it and see what there is there.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.