June 19th, 2013, 11:00 AM
Using dynamically created static link with premade template
I've been overloading my brain trying to figure this one out and could use some direction. I don't need snippets (though won't turn down the help :P ) just help figuring out the logic behind how to achieve this. Here's what I want to achieve:
I'm making a local job listing site, and I want the url to be the job title, so mysite.com/jobs/job-listing-name.php ... I want to have a stock template for the listing, normally this is easy enough, and I'd just use the ID for the file name, but that would be like this: mysite.com/jobs/template.php?id=.... so how can I make a stock template without using variables in the URL is my real question? I know I can get all info from the db where the job title is equal to the file name, but I have no idea how to make the templated page under the unique page name. Thanks in advance, and this is probably all over the internet but I have no idea how to word it so google is of little help, in fact this whole blab probably will need to be clarified a lot before I can even get a usable answer. Thanks!
June 19th, 2013, 11:21 AM
You would use modrewrite just like devshed does.
Proceed from there.
HEY! YOU! Read the New User Guide and Forum Rules
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002
Think we're being rude? Maybe you asked a bad question
or you're a Help Vampire.
Trying to argue intelligently? Please read this.
June 19th, 2013, 11:39 AM
Thanks, and I'm assuming it works the opposite way? And will that work with get?
June 19th, 2013, 12:36 PM
what he posted uses GET variables?
btw at least try to learn about mod re-write instead of asking here, everything will become clear. (I hope)
June 19th, 2013, 01:50 PM
It's a one way conversion and the RewriteRule is able to retain any passed GET variables.
Originally Posted by neg89
I use it (well, used it) to convert URLs like:
to function as:
The end user will only ever see the "pretty URL", but the webserver will treat it like the latter.
But I've since changed my system to relay all requests that don't match a literal object into my PHP, for my PHP to handle the above kinds of routing. But that's probably more complex than you'd want to deal with here.