I need to do a HTML string concat (using PHP or Javascript) and I don't know how to do it.
What I'd like
<src="http://maps.google"+$city+"rest_of_the_link">
(I've already tried the previous code but it doesn't do the trick)
You can't. HTML doesn't have strings … or variables. It is a markup language, not a programming language.
You can generate HTML from another language (which could be a program that is executed automatically by a webserver to generate the content for a URL), and you can use DOM APIs (again from another language) to manipulate a DOM generated from an HTML document.
You cannot do that with HTML alone. HTML is not a programming language, it's a markup language (hence the HyperText Markup Language), for that reason, no variables (or control structures, or anything of that sort) is in it.
What you need to do, is to supply yourself with a different language to help generate the HTML.
For example, in PHP you'd do something like so:
<?php
$city = "London"; //Set the variable
echo "<src=\"http://maps.google".$city."rest_of_the_link\">"; //Echo result concatenating $city inside.
?>
I think what you're looking for is templating.
You can load the HTML as a template, and then plant values in specific locations. If you load it from the server side you can use django templates (I use django and my backend is in python), and if you're doing it from the client size, through javascript, you can use jquery templates or the jqote plugin for jquery which is apparently faster than the native jquery solution.
For example, If you're using django, your html would look something like this:
<src="http://maps.google{{city}}rest_of_the_link">
And when you load it using the server, you pass a dictionary object that has a value for the key 'city'.
I'm not sure what is the best method for php templates, but this is something you can probably find easily when you know what you're searching for.
$citysupposed to be?