0

I'm currently working on a project almost like steamrep.com but for another game and more features. I know basic php js etc but there is 1 thing i can't seem to understand. And that is when you for ex search for

     yourdomain.com/profiles/ (any id / username) 

I can't seem to figure out how to make it so it takes the givin id / username puts it as a variable and display it on a page.

If anyone could give me a lead that would be verry much appreciated!

EDIT: To clear up the question. I want to take the id or username from the url and display it the page as a variable.

Domien
  • 11
  • 5
  • Are you trying to grab the variable in JavaScript or PHP? I assume the latter? – Obsidian Age Jun 28 '18 at 21:57
  • There are many different ways of displaying part of the current URL on the page. One way is with JavaScript: assuming a numerical ID, `let id = location.href.match(/profiles\/(\d+)/)[1];` then display `id`. Though, if you want to display other contents that depend on the ID, a server-side implementation may be more appropriate. It all depends on what you’re trying to do. – Sebastian Simon Jun 28 '18 at 21:59
  • I'm trying todo something like steamrep.com. I would use an api to load in names and data i can do all this but when they search for mydomain.com/profiles/ (any id) it has to take that id and display it on the page. – Domien Jun 28 '18 at 22:02

0 Answers0