Hi, I'm making an attempt to build a small cms based site. I have read in a lot of places it is best to use the id of a table row to fetch contents, but being as I am using url rewrite in frontend, it won't be showing query strings, so I thought I would ask if anyone saw any potential problems if I did the following.
Page table looks like this:
Pages
- id
- name
- content
In backend, the user has a form to name the page and use ckeditor to add rich content. I will use php to ensure that the name is alphanumeric and use strtolower & str_replace to ensure that My First HTML Page is sent to mysql as my-first-html-page and also check that a row with this name does not already exist.
So on front end this page url will be mywebsite.com/my-first-html-page
So to output the content I strip out the domain & / so I'm left with the name as entered in the db.
Then in my function to output content I will use WHERE name = $urlPHP Code:$url = $_SERVER['REQUEST_URI'];
$url = str_replace ('/','',$url);



Reply With Quote



Bookmarks