Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm new to using php (and its been I while since I've coded) ... but anyway, I want to create a website that uses two languages.
I've been reading up on google's best practices (Multi-regional and multilingual sites), but I'm yet to find something that can help me with the actual development.
The site will contain at least 30 pages and need to be compatible with all the major browsers.
Really appreciate some advice on this. At the moment I don't no whether to create a page for each language (because lang='' doesn't appear to be compatible with all browsers), or hide and show div's on page load or dynamically load the content with php ... what is the best practice?
Apologies if this is a little generic ...
Thank you in advance!
create a page for each language
This is sensible.
(because lang='' doesn't appear to be compatible with all browsers),
Browsers don't generally need to care what language the page is written in. They just need to display the content to the user, so that doesn't matter.
Some screen readers might look at lang to determine which pronunciation guide to use, but few other tools used directly by humans will care.
Language can influence which character encoding you use (although in most cases the answer is "Just use UTF-8"), but that is specified independently of the lang attribute.
or hide and show div's on page load
This sounds like you will have a page that just jumps between languages, unless JavaScript is available in which case some of it will be hidden from the user. I wouldn't do that. Have sensible documents.
or dynamically load the content with php
Dynamically generating the content server side is one way to produce pages in multiple languages. It is still sensible to give them independent URIs so users can link to specific ones.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am a beginner and have to do my first webpage in two languages.
And I don't really know, how to make this work. It should be a simple portfolio page.
Should I make:
2 pages, one for "en" and one for "fr"
make a PHP page and create a database with all the text to be shown for each language? If I make this db should the hosting of the client have some special options to receive php? (I`ve read it somewhere and want to validate it).
Maybe I have asked some awkward question but: Answer me from your practice how you would do this multilingual website.
As you have more or less identified, you have three broad options:
Write 2 separate HTML webpages and edit each one separately with a text-editor
Write a single server-side file using PHP (or any other server-side scripting language) and use the server-side engine to create the page and populate it with either English content or French content
Write a single client-side page using javascript (and possibly Ajax and JSON etc.) and use the client-side script to to populate the page with either English content or French content
N.B. If you go for Option 2 (the server side approach) you do not need a database. Unless your page is extraordinarily complex, an array will likely suffice.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
so i want to develop a mini website builder within my website. Have a control panel where users can edit the text in their websites, i want each of those html pages to have its own css file attached to it. Now, i want it so that the user sees something like a button saying "Edit Background color" they are prompted with a color picker and on hitting save, the css file is updated without them knowing that css even exists.
I would like to know what language i can use to make the previous example happen. And if possible a hint of code.
I appreciate your answers, Braulio :)
I didn't downvote you but just for informational purposes, the reason you were probably downvoted is due to the scope of your question, The language you choose depends on what platform you are running your site on. And it is likely possible to do what you want in tons of different languages assuming your platform supports them. For an easy solution check out .net languages like c# with ajax controls for live updates without refreshes. But then again you could use ruby with rails. Or you could do most of it in the client side with jquery and javascript then send the results to the server which could utilize php. It is just to broad a question to really answer without writing the whole thing for you which nobody is going to do.
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'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.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I've got a site that is based around a contact form. This form is generated according to the variables passed in the URL, and the information passed is put in headers in the body, and also in the title. Additionally images are customized, so basically the whole content is changed according to these variables.
So I've run a sitemap generator, and it's actually generated lots of these www.site.tld/me.php?a=hi&b=pie, www.site.tld/me.php?a=hi&b=chocolate, www.site.tld/me.php?c=hi&hello.... you get the point.
So, my question is: is it smart to use this to my advantage, include these in the sitemap and customize them for SEO, or should I just ignore it and omit it from the sitemap?
In general having dynamic urls is okay, but you don't necessarily want them indexed for SEO purposes. In general its better to have a well organized url structure, as its seen to be more appealing. (i.e. site.com/article/sports/baseball123 is better than site.com?id=123433). So depending on your content (whether its static or dynamic) you may want to move to that type of a url structure, and have your pages indexed. On the other hand if you need to keep dynamic urls (for some reason) and depending on the nature of the content, it may be best to leave them out of the equation from an SEO perspective. It ultimately comes down to what you're serving from these pages.
Search engine friendly urls by using apache rewrite module search apache mod_rewrite in google there are many ways to do this and there are some ways that work much better than others. Google will index your site based on the content on the page rather than the url or any meta information. Using the mod rewrite makes it easier for your viewers but as far as search engines are concerned it dont really matter. Hope this helps