|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
lafours Smarty Rookie
Joined: 17 Dec 2007 Posts: 8
|
Posted: Sun Dec 30, 2007 3:09 pm Post subject: Search engine friendly URLs $10 for solution |
|
|
Hi Guys,
My website www.thisismereporting.com uses clipshare which runs on smarty templates. Can anyone advise on how I can get the url of each video to contain the title of the video rather than a jumble of numbers and letters?
I've read about mod rewrites but this is too advanced for me at the moment. Can it be done through code?
Thanks
Last edited by lafours on Wed May 05, 2010 10:43 pm; edited 1 time in total |
|
Back to top |
|
nunyez Smarty n00b
Joined: 02 Feb 2007 Posts: 4
|
Posted: Thu Jan 03, 2008 2:17 pm Post subject: |
|
|
Friendly urls = mod rewrite. Its very simple really, just a regular expression. You'll likely have to rework your database to be compatible however.
If you really fear modrewrite I suppose if you modified your database to have a table that correlates the friendly title of the video to the 'jumble of letters and numbers' you could easily modify your query to find what youre looking for. Or add an extra field if you dont want another table. Understand?
What's with the money offering in these posts? If anything, that should be in the other forum... work for hire... |
|
Back to top |
|
cowboystyle Smarty Rookie
Joined: 02 Oct 2006 Posts: 5 Location: New York, NY
|
Posted: Thu Jan 03, 2008 3:08 pm Post subject: |
|
|
I've found this to be very helpful:
.htaccess file in the directory you'd like to rewrite:
Code: |
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.php [L]
|
So now, all your requests that don't have a static file to land on (like a background image or CSS file) will forward to index.php.
Now, to figure out what is being requested, in index.php:
Code: |
$page_request = explode('/', $_SERVER['REQUEST_URI']);
array_shift($page_request); // Remove first array cell (empty)
/* If the page request is: www.site.com/foo/bar */
echo $page_request[0]; // Will output 'foo'
echo $page_request[1]; // Will output 'bar'
|
|
|
Back to top |
|
mellowonpsx Smarty Rookie
Joined: 03 Jan 2008 Posts: 5
|
Posted: Fri Jan 04, 2008 8:48 am Post subject: |
|
|
cool |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|