can somebody explain me why it is " ich gehe die Strasse entlang" oder "ich gehe entlang der Strasse" (die-der?)
You know entlang means along or alongside.
One could see a subtle difference. Like in your first example it can mean to go down the street to the end (to reach something at the end). The second is more like walking causally along the street.
But the both could be used for the two examples (with the right context)
For the second example it is der Strasse entlang (Genitive) as you used correctly.
Perhaps this discussionon on wordreference is interesting for you. (it's in German)
"entlang der Straße" is more commonly used for things/people standing (or to be seen) along a road; "die Straße entlang" would be the usual phrase for movement along a road.
"Ich gehe die Straße entlang."
"Die Häuser stehen entlang der Straße."
"Entlang des Flusses sieht man viele Burgen." ("Along the river you see many castles.")
stepintime - Do you use Ich gehe die Straße entlang. always to mean that you are going along the side (at the side) of the road, and never being in the road proper? I get the movement part. But is it next to the road and not in the road? Like moving on the sidewalk?
Edit: I see now that both MichaPau and Angel seem to have answered this. It could be in the street.
Yes, it can be anywhere on the road, in the middle, on the sidewalk, or even beside the road. Cf.:
"den Fluss entlang" - can be on the river (going by boat*) or next to the river (walking on the banks or driving on a road - the road could even be in a bit of a distance, as long as it still seems to follow the course of the river, on the whole).
"ich gehe den Zaun entlang" - obviously next to the fence, not on it :)
(*If you swim, personally I'd say "ich schwimme den Fluss hinauf/hinab" instead of "entlang". Can be used for boats as well, of course.)
stepintime gave very good examples. So '...die Straße entlang' sets the focus on the action. Going, driving, running along the street. '...entlang der Straße' the focus is on the street or what is in the street. Houses, people, cars. And as stepintime wrote this is not only for streets, of course.
best regards Angel