teixeraf Posted October 1, 2009 Share Posted October 1, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/176186-unobtrusive-phpjavascript/ Share on other sites More sharing options...
KevinM1 Posted October 1, 2009 Share Posted October 1, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/176186-unobtrusive-phpjavascript/#findComment-928467 Share on other sites More sharing options...
teixeraf Posted October 1, 2009 Author Share Posted October 1, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/176186-unobtrusive-phpjavascript/#findComment-928481 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.