Welcome Guest, Not a member yet? Register   Sign In
How can I hide content id on URL
#11

(12-05-2016, 12:11 PM)PaulD Wrote: Hi,

This is quite straight forward to do.

1. In a table for products you would have product_id, product_url, plus all your other columns like name, price, description etc.
2. The product_url is a unique column and can be auto generated based on, say, the required product_name, or your user or admin can add a custom one from your 'add product screen'.
3. When you generate a url like your example, you do not send the 'id', you send the 'product_url' and look up your product from that.

PHP Code:
public function view_product($product_url)
{
 
   // do your query on the product_url


To generate the url you would do

Code:
<a href="<?php echo site_url('products/view_product/'.$item['product_url']); ?>">ProductName</a>

The url will then be something like:

Code:
www.mydomain.com/products/view_product/my_wonderful_product

So now, the product ID's are only for internal use, any reference to them in url's or your HTML is by url name, not their id. (By internal use, I mean once you have the product, you would still gather other related tables via the id, such as related products, special offers, related articles, reviews etc).

Hope that helps.

Paul.


Really I do not understand what you mean with this. I give my codes, maybe you will help me with my codes ?
Reply


Messages In This Thread
How can I hide content id on URL - by olmos - 10-20-2016, 06:42 AM
RE: How can I hide content id on URL - by Shawn - 10-20-2016, 03:15 PM
RE: How can I hide content id on URL - by olmos - 12-04-2016, 03:06 AM
RE: How can I hide content id on URL - by olmos - 12-04-2016, 12:00 PM
RE: How can I hide content id on URL - by olmos - 12-05-2016, 05:20 AM
RE: How can I hide content id on URL - by PaulD - 12-05-2016, 12:11 PM
RE: How can I hide content id on URL - by olmos - 12-06-2016, 01:44 AM
RE: How can I hide content id on URL - by PaulD - 12-06-2016, 11:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB