Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I've been playing around in the Web Development field for 2 years now and I am pretty proud when it comes to my progress as a programmer looking back at my humble beggining. This is not very relevant but I've wanted to back up my question with some background story. What it comes to my interest during a conversation with a friend was how to best structure your code when it comes to a website so it wil be very scalable for further modifications using an oop aproach. He suggested at the end of the discusion to use php classes to generate the html content. I personally use it like this only when the php helps me to retrieve something server-side related. I use HTML, CSS and JavaScript (in that order) as much as possible before calling in PHP. That's how it should work, in my opinion, especially when you have to work on a presentation website for example. What's intrigue me thinking about my friend proposal is that I structure my code that way using php clases to echo html content parts like header, menu, forms, slideshows, footer etc. will indeed scale my code way better and help my programming skills progress. I should end up with an index.php that returns objects of the respective classes creating that way the desired html content. This is how I image things working and I am asking you to help me reach a decision. I have some upcoming free time available and I want to invest it in becoming a better web developer.
It is generally a bad idea for all HTML to be generated this way.
In professional web development you often have front-end developers and designers whose only responsibility is the HTML/CSS/assets and/or JavaScript. The backend developers, (the ones writing PHP code), are usually responsible for the business logic of the application.
By having PHP generate HTML you are violating separation of concerns principles. Things will get messy. It's harder to scale up, and you will lose the benefits of being able to use a HTML editor.
Generating HTML serverside dynamically has uses in very specific circumstances. It can be done, but just because you can, doesn't mean you should.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
first of all, sorry for bad english. Please correct me if I write something wrong!
I'm a "noob" in the programing scene, so I need some help. I want to help my mom to automate a process at her bussines. The core thing I need to do are this:
I need to extract info from a webpage (it's an php webpage), and compare the products that arrive with the one's displayed in the webpage. I want to do that scanning the bar codes of the products (I've a database of all the products barcodes). Then I need to save the comparission in a file just to make sure that everything is ok. I want to know wich languague is better for my case. (Then I will try to do it, fail, learn from my mistakes and then have some "stable" program to do this)
TL;DR: I recive products, I check if everything arrived in a website. I want to do that using bar codes and "automate" the process. I want to know wich languague is better for my case.
Thank you!!
As others pointed out in the coments, there is not best language, you need to chose the one that fits you.
But let me give you some recommendations on what might work.
You said that the site is already in PHP, that's the backend language. You should keep using it since a part of the site is already built with it. Other options are JavaScript using NodeJS, Python, Java, Ruby.
You can do almost everything you need in the backend (server side) using PHP, but some things might be better to solve them in the client side (front end) using JavaScript, is the default language that runs on the browsers.
Usually you use the backend language to serve pages, interact with a database, send data to the client. And the front end (JavaScript) to add dynamic functionality to your website.
Web apps used to depend a lot on the backend, reloading the page for every action, sending a lot of information back and forth.
The modern aproach to build web apps (like yours) is a bit more dependant on JavaScript. You load the page once and then just do AJAX (Asynchronous JavaScript and XML) requests to the server asking just for the information you need and showing it dynamicly with out reloading and having to load the HTML/CSS all over again. Many frameworks like Angular, React (with its whole ecosystem), help you a lot with it.
Read more about it here.
EDIT: just to clirify, I answered with some recommendations and opinions because it is what the question asks for.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I learning about web-crawling and I and don't know whether to use php or python. I want to make a website that takes information from another website and automatically updating.
And does it possible to make a decent website with python? or I have to paste the information from python to html or php?
It depends a bit one the nuances. PHP is a language mainly used to develop websites (to present them), whereas Python is used for both programming websites and programming other applications. Thus, it depends on how application-like the scraping will be or how much it will be included into the (presentational) website.
Python is well-suited for scraping tasks as it has a lot of third party libraries (Scrapy, BeautifulSoup, lxml, request, ...) and also built in libraries for requesting URLs. With PHP you will have a harder life requesting other websites. As said, it is mainly focused on building an own website.
Also it of course depends on your skill level in each language.
I'd split the application into two parts anyway:
presentation logic (your own website)
scraping logic (scraping other websites)
Both will be connected through a database. The scraping logic collects information and stores it into the database. The presentation logic takes information from the database and displays it to the user as HTML.
For the scraping part, you then want to prefer Python over PHP. And for the presentation part, it actually does not matter and is a matter of preference or knowledge.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
this question is coming from a complete noob in programming. So, my aim is to study lots of things to create in the end from scratch a site similar to Quizfarm. That is, I need to develop a system that will allow me to create new quizes from scratch, post them in the necessary categories (for example fun quizes, serious quizes, quizes for children, for grown ups, for anything).
Visitors will be allowed to login, to have their own profile page (with the ability to upload an avatar image) and can see which quizes they took and how they scored. The site will feature a ranking system for each quiz independently, ranking for each category and total ranking (for example). In addition, it needs to have the ability that members can win small prizes (not monetary prizes, but just simple icons that will show in their profile, like achievements).
I know, my question is too vague possibly, and the whole project very large. I suppose that programming languages like php and MySQL are necessary. Which other languages should I go for (except of html/css of course for the design part)?
Thanks for your time and I will appreciate any answer.
As others have stated your question is very broad and you can use any programming language that you like. From experience however I would highly recommend that you use PHP.
It's relatively easy to learn, very adaptable and it doesn't mind if you make mistakes.
So for the front end HTML and CSS, for the actual website PHP, and SQL for the database
You can also use JavaScript or jQuery. It will definitely be needed down the track, but use it sparingly until you get a good web application working first. You'll mainly need it to enhance user interactivity.
Hope that helps.
HTML
CSS
PHP
Mysql
Javascript with jQuery lib
Those are the basics that you will probably need for this project
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have been learning web design/development for a while. I have basic knowledge of CSS(3),HTML,PHP,MySql(i). I also started exploring Drupal.
Now, I tried to use DRUPAL but it's not perfect. (Memory Expensive/Less Freedom). I am also not expert enough to tear down everything from Drupal and use things.
I then started to notepad and tried to create with every single HTML tag. It's not as exciting when you are not perfect.
I could combine Dreamweaver GUI and my own coding or free codes from external sources. I do not have access to DREAMWEAVER which is a great tool.
I have seen Expression Web but did not have time to explore.
Given my middle level of knowledge, and constraints, which path is best for me? (Continue with notepad(or basic html editors)/Try Expression Web/try to be happy DRUPAL/other solutions).
I want to make it dynamic with features like user registration/search feature/APIs/. I will include a lot of external codes. (This was one of the places I had difficult implementing in DRUPAL).
With the kind of things you want to do, you really need to bear down and learn how to do it in a text editor. While you don't need a mastery of PHP/JS/CSS (because of libraries and things like that), there really is no substitute for simply knowing how the back end works, especially if you're looking to create unique and dynamic webpages.
There's a free tool I used to use a while back called Komodo. It had some intellisense features for PHP/HTML.
Stay away from WYSIWYG editors at this stage - like the JNatalzia said, you should know how the back end works. There's nothing worse than trying to work with a developer who doesn't know basic HTML syntax and can't make a change that the WYSIWYG editor doesn't support (and believe me, they ALL have things you can't do without getting your hands dirty in code).
If you want to be a proficient web developer or designer, don't use any wysiwyg editor for HTML and CSS.
My suggestion to you is to work on the languages themselves, without any plugin at all, and ensure that you understand and know the basics of each of them. Use a simple text editor (NotePad++) until you feel comfortable with them, then you should move to frameworks and other tools.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am new to PHP, coming from ASP.net background, the most trouble I am having is generating html from PHP. My question is how is it done in industry? I see 4 ways:
generate from inside PHP program.
use PHP "helper classes" to do that.
mix PHP from inside HTML.
use templates.
Are there more ways, and which one is used on professional projects. If it number 2 or 4, could you suggest "best" (most used) helper classes, or templates.
Use an MVC framework like CodeIgniter, and follow the standards there. Try to keep your business and display logic as separate as possible!
The reasoning behind this is that if you decide later on to modify your code, it's easier to find the code in question. It's simpler to search through a few template files than it is to pick through all your logic to look for one snippet of html.
Most professional development is now done using an MVC framework, such as CakePHP or CodeIgniter.
You could also look at a standalone templating system like Smarty.
When you start with php, you find several ways to generate your webpages.
Html is a template language, so it is just formatted string, and php is very good generating string, so you have a lot of ways to do it.
But some ways are better than others.
For example: If you mix your html code with your php code, you get a very difficut to read, mantain and scale code, so it is better if you separate the code in layers. MVC is a design pattern that handles very good this kind of layer abstraction, so read a little about it.
Inside PHP, you could find several tools to do it at the good way, like using a framework for your project. The frameworks make easy and quick your development and manage the mvc abstraction well.
I recommend Laravel, it is easy to use and is so powerful, that you will do your job really fast.
But if you don't want to use a framework, you still could separate your logic from the html code, and fill the html only whe you need. Look at The following class, maybe it could be useful to you.