PHP - Website In Different Languages?
Hi
how can I have the same website in a different language? So for the visitor, they would click on the appropriate flag and the site would then be displayed in their language. Similar TutorialsHi guys, i was wondering.. Languages? How does that excactly work? Where do you save the different language strings, and that stuff? Do you have php files' for each language, and just includes them? Or,.. Anyone who can explain me? thanks =) The first thing I learned after HTML and CSS is PHP. Its my primary language now, but I also use SQL and javascript and XML regularly, and since I use linux, I use bash scripting. The cool thing is they all work hand in hand. I recently learned how to use SQLite too, which is good because it can be accessed directly by javascript. Are there any other languages which would enable me to make new things and combine them with PHP scripts? I was looking into java but the security restrictions on applets make it pointless. Flash actionscript looks good. What about perl? Or ruby? Would they enable me to do things I can't easily do with PHP? I've heard about node.js recently a lot so I'm looking into that. Bash scripting is great, but the only issue is I could only use it on a server owned by myself, commercial servers won't let you execute commands like that. I'm interested in perl, python and java but I'll only learn them if they enable me to do things I can't do (easily) with PHP.
Hi guys. This is my first post here - so HELLO. I am a very experienced software developer, but new to web work. I am building a software tool using PHP (primarily). As such, many of my questions will concern optimum solutions (in so far as they may be determined), best practices, and the unwritten standards that will surely have evolved through the PHP community over time. My first question concerns the mixing of HTML and PHP. My efforts so far contain a mix, but it doesn't "feel" right. I am using straight XHTML, PHP echo, and also heredoc. I can post the code if folk think it may help. But what is the general view as to whether "mixing" like this is a good and accepted practice, or is another approach preferred? Many thanks in advance for any replies. S Hello there, I have a CMS which I've trying to create localization for. The idea is in the admin area you check a radio button and it changes the language of the entire admin interface. There is a mysql database with a table called nb_settings that has a column called lang. Up to this point I've gotten it to work but am having problems adding additional languages. The localization files have names like lang.nl.php,lang.en.php and so on.. The original code that works is this in a file called settings.php: ... <?php if($row['lang'] == nl) { echo '<input name="lang" type="radio" value="nl" checked="checked" /> '.($_CONSTANTS['NL']).' <input name="lang" type="radio" value="en" /> '.($_CONSTANTS['EN']).' <input name="lang" type="radio" value="de" /> '.($_CONSTANTS['DE']).''; } elseif($row['lang'] == en) { echo '<input name="lang" type="radio" value="nl" /> '.($_CONSTANTS['NL']).' <input name="lang" type="radio" value="en" checked="checked" /> '.($_CONSTANTS['EN']).' <input name="lang" type="radio" value="de" /> '.($_CONSTANTS['DE']).''; } elseif($row['lang'] == de) { echo '<input name="lang" type="radio" value="nl" /> '.($_CONSTANTS['NL']).' <input name="lang" type="radio" value="en" /> '.($_CONSTANTS['EN']).' <input name="lang" type="radio" value="de" checked="checked" /> '.($_CONSTANTS['DE']).''; } ?> ... Another file called common.php is used as well and has the following: <?php session_start(); header('Cache-control: private'); // IE 6 FIX $sql = "SELECT * FROM nb_settings"; $query = mysql_query($sql); $row = mysql_fetch_assoc($query); if($row['lang'] == nl) { include('languages/lang.nl.php'); } elseif($row['lang'] == en) { include('languages/lang.en.php'); } elseif($row['lang'] == de) { include('languages/lang.de.php'); } ?> But I am havng trouble adding more languages and expanding this. There is a folder called languages into which I put the individual localization files. Just adding similar lines of code as shown below in both common and settings files doesn't do it: ie: 1)modifying settings.php to become: <?php if($row['lang'] == nl) { echo '<input name="lang" type="radio" value="nl" checked="checked" /> '.($_CONSTANTS['NL']).' <input name="lang" type="radio" value="en" /> '.($_CONSTANTS['EN']).' <input name="lang" type="radio" value="de" /> '.($_CONSTANTS['DE']).' <input name="lang" type="radio" value="fra" /> '.($_CONSTANTS['FRA']).''; } elseif($row['lang'] == en) { echo '<input name="lang" type="radio" value="nl" /> '.($_CONSTANTS['NL']).' <input name="lang" type="radio" value="en" checked="checked" /> '.($_CONSTANTS['EN']).' <input name="lang" type="radio" value="de" /> '.($_CONSTANTS['DE']).' <input name="lang" type="radio" value="fra" /> '.($_CONSTANTS['FRA']).''; } elseif($row['lang'] == de) { echo '<input name="lang" type="radio" value="nl" /> '.($_CONSTANTS['NL']).' <input name="lang" type="radio" value="en" /> '.($_CONSTANTS['EN']).' <input name="lang" type="radio" value="de" checked="checked" /> '.($_CONSTANTS['DE']).' <input name="lang" type="radio" value="fra" /> '.($_CONSTANTS['FRA']).''; } elseif($row['lang'] == fra) { echo '<input name="lang" type="radio" value="nl" /> '.($_CONSTANTS['NL']).' <input name="lang" type="radio" value="en" /> '.($_CONSTANTS['EN']).' <input name="lang" type="radio" value="de" /> '.($_CONSTANTS['DE']).' <input name="lang" type="radio" value="fra" checked="checked" /> '.($_CONSTANTS['FRA']).''; } ?> 2)and adding in common.php: elseif($row['lang'] == fra) { include('languages/lang.fra.php'); } Both don't work. The php is obviously not correctly parse and the syntax may have issues. Can anyone help me out with how to add additional languages? I'm developing an arabic site...but also want to view it in English...I'm thinking of using windows translating service (depending on good it is). Now I was thinking of having columns in my table like so...english title, arabic title, english description, arabic description As it can charge for words to be translated...when translating arabic to english I can store the results in the column so they would no longer have to be translated again My question is...is it good practice to have separate columns for different languages?...thank you...any input would be great I have a time and date using the code echo date("l jS \of F Y H:i:s."); Now I need to show this in several different languages, including French German and Dutch I have tried setlocale(); and echo strftime The date shows but still in English. Any idea how to show the day date and time in Php for the languages suggested. I am looking to add Spanish to a website and would like the users to be able to click a button to switch between english and Spanish. Is this something that php would be good for or should I look into another language? Would there be a benefit to doing this on the client side versus the server, hence the use of javascript versus php? I would appreciate any help in this area; samples, websites, and such. I am looking to learn, and not for someone to do all the work for me. Thank you in advance for your help. Hi everyone this is my first post so I'm sorry if I've posted it in the wrong section! Before I begin I'd like to point out that I'm not just here to get someone to produce what I want for me! I have a genuine interest in this forum and I'm slightly surprised and disappointed in myself that I hadn't took the time to join sooner! Anyway to the point of this post: (Please bare with me I think I'll need to justify the use of SQLite) I am currently undergoing a University gorup project that uses wireless sensors to collect environmental data such as, Temperature, Humidity, Light levels and Dew point. This application is programmed in Python and it collects these pieces of data (every 30 seconds) and places them into an SQLite database. My job is to now graphically plot/show the data that the Python program collects and stores in the SQLite database on a web page. I'm using Ubuntu and have successfully installed LAMP, SQLite3 and the SQLite PD0 driver. I have also successfully established a connection to the SQLite database as well as displaying the data on a web page (locally - thats all I need!) in the form of a simple HTML table through the use of the following PHP script: Code: [Select] <?php try { //open the database $db = new PDO('sqlite:/var/databases/307Code/python/readings.db'); //now output the data to a simple html table... print "<table border=1>"; print "<tr><td>Date & Time Recieved</td><td>Node</td><td>Temp</td><td>Hum</td><td>Light</td><td>Dew</td></tr>"; $result = $db->query('SELECT * FROM readingstable'); foreach($result as $row) { print "<tr><td>".$row['Recieved']."</td>"; print "<td>".$row['Node']."</td>"; print "<td>".$row['Temp']."</td>"; print "<td>".$row['Hum']."</td>"; print "<td>".$row['Light']."</td>"; print "<td>".$row['Dew']."</td></tr>"; } print "</table>"; // close the database connection $db = NULL; } catch(PDOException $e) { print 'Exception : '.$e->getMessage(); } ?> What I'm now looking to do is the following: 1. Display the data from the SQLite database in the form of line graphs (I've seen that I may need to convert the data to XML?) 2. Make the application asynchronous, preferably every time a new entry is added to the SQLite database the line graph(s) update without a user needing to refresh the browser. 3. The SQLite database is storing a ridiculous floating point number for the time field in the database, for example: "2012-03-23 16:49:42.440818" is a entry in the SQLite database. Is there any way to omit the .440818 through the use of PHP? Or will I need to edit the Python script? Also one thing to note: The person in my group who built the Python script didn't build it to make the SQLite database give each database entry a unique ID/Primary key. Any tips/advice/help would be massively appreciated! Regards, Rich I'm trying to make a League of Legends (a video game) community website, both as a personal project and for practice. Now the game has a lot of champions, each of whom have 5 unique abilities. Now, I thought about manually inputting all the details about each champion into a MySQL database, but that would long and tedious, and I don't really have the time for it now. Also, the game patches very oftern (like, once every 2 weeks) which changes many of the stats, etc. of the champion, and it is not possible for me to keep manually updating these every time there is a patch. Fortunately, there is a League of Legends Wiki which has all the data I need in their specific champion pages, which they keep updated per patch. So I was wondering if there was any way to get the data from the divs in the wiki, and have it display on my site. What I want to do in my website is that whenever someone types a champion's name (in a post or whatever), I want it to display a hover-over dialog with some of the champions details. And a lot of other features such as that. In plain English I need a way to : > Tell PHP to go to the wiki's source code on a specific page > Find a specific div container > Get X data from there > Pass X data into a function to display the hover-over I think this way, I would not have to maintain a database as I can leech off the wiki's data. I have not coded anything like this before, so I would like a few pointers as to how to achieve this. Any help will be appreciated! hello My database is in a same server with seperate domain name , then I want to insert from website1 mysql data on website2 mysql data. can anyone help me? I tried searching on google but couldn't find any relevant information, please redirect me to relevant source or help me with the code. I want to pass a domain name in text field which will be scanned and then the script will display entire site map. Not external links or links on a page. Sorry it is not easy for me to explain. Eg. if i pass abc.com Script will display abc.com/12/adn.php abc.com/asd/asd/ etc Whatever their url format is. All the links on that domain. Is it possible to download files from a website to my online websites root directory? reason I'm asking is because I have been downloading large video files to my computer which take about 20 minutes!! Then I use FTP to upload them to my site but it takes about 2-3 hours per video!! I was looking for a faster way! All help would be great! Hello everyone and thank you for reading this.
My goal: Build a site like sportingnewschicago.com
What it does? It has different sectiions of different teams. Then it displays the tittle of the news and makes them be able to click on to go to the news site. The site some how checks a list of sites and post them on their respected section. But only ones that have not already been listed.
What i want to do? Well i want to try to learn how to do this. Is this something i can make with the help of members here? It would only have index.php and thats it.
Please let me know if anyone would be interested in teaching me as i do it. If not i would understand. Thank you.
My code on website is not validate on W3 Validator.
<?xml version="1.0" encoding="ISO-8859-1"?> This would be an example of a page I'm referring to: http://www.curse.com...other-downloads
I want to get the file name and compare it to another name (to see if they are the same or not). I have no idea how to access that page from my website. I'm guessing PHP would be best although if you don't think so tell me what you think would be better (I was thinking javascript but don't think that's cross-site compatible). Is there a PHP function to get the value of the href which is in this case (as of this posting) "Railcraft 9.4.0.0".
I used inspect element to see the code of the page but have no idea if this is possible or if I'm even going about this the right way. The code would have to work on this entire website (all pages have the smae layout as this one though! Any help is greatly appreciated!
Hello everybody!
I have been asked by a customer to develop a GTP website (Get To Pay, those websites where people earn money from clicking on ads). I managed to write the backend, signup and login but I am unsure how the ads part, with built-in user-tracking works and fallback link works.
I would really appreciate any kind of help.
Thank you very much!
P.S. For the user tracking I was thinking of sessions with matching ip and user agents together with an anti-proxy online service (e.g. MaxMind, Proxystop, ...)
Hi, I haven't used any php for a while, but i am making a website, and i need some advice on how to do the following: I want the website to change an image once every 24 hours, the image will revert back to the original image after 2 minutes. Does anyone have an idea how I could start doing this? I am working on a website and I am at a standstill. I would rather speak to someone one on one but its been very difficult to find someone that could help. I have the scripts that I want but when I add the scripts to the mainpage everything stops working. I really don't want to go to wordpress because I am almost done with this one. Thanks.
Hi there Can anyone please help me. I am trying to get my website working but i am struggling big time with the php. The things i need to do are not to complicated however my lack of skill with php is making me struggle. I need help in making the php work on my website. Can anyone help please. (Please note it is not a commercial or business website.) Anyone who can help please contact me. Thanks I was not expecting this but when I managed to connect to a chatroom and close out firefox.... The user stayed in the chatroom. This user should of pinged out by now but it's staying online. How do I end this connection? So far I turned off my internet, and blocked all access to the site. |