|
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 |
blackhawkmx Smarty Regular
Joined: 20 May 2005 Posts: 76
|
Posted: Wed Oct 15, 2008 2:19 pm Post subject: communication with .htaccess |
|
|
not sure if this question should fall under this section or under tips and tricks.
I know that mod_rewrite does not change links, but is there a way that smarty or php can communicate with my .htaccess page to rewrite my links so they match my rewrites? i just don't wanna go in and manually change my links to what my rewrites should have to be.
If there is a guide online that already shows how to do this, that would be great!
thanks!
blackhawk
_________________ Bring it back to basics. You and I can make it right! |
|
Back to top |
|
Celeb Administrator
Joined: 17 Apr 2007 Posts: 1025 Location: Vienna
|
Posted: Wed Oct 15, 2008 3:18 pm Post subject: |
|
|
You could use an output filter to modify your links. I guess this filter could parse your .htaccess.
How do you want to rewrite your links? Maybe it's easier to just rewrite the current links as they appear in your HTML output to whatever you want them to in your .htaccess. _________________ Darn computers always do what I tell them to instead of what I want them to do. |
|
Back to top |
|
blackhawkmx Smarty Regular
Joined: 20 May 2005 Posts: 76
|
Posted: Wed Oct 15, 2008 3:34 pm Post subject: |
|
|
In my case celeb you are absolutely right. I only have 5 different page to come across, and it would only take me 2 minutes to make the change manaully.
But what do you say about a website that is "already" built and has 100 pages and your client wanted you to change not only the url with .htaccess (which is fine), but also the links through out the site?
quick quesiton
when registering a filter at run time, inside my function called changelink below, is it possible to do something like this. the syntax below is wrong but it should explain my point...
Code: |
function changelink($output, &$smarty)
{
return str_replace('index.php?page={$page}', '{$page}, $output);
}
$smarty->register_outputfilter('changelink');
|
thanks for the help _________________ Bring it back to basics. You and I can make it right! |
|
Back to top |
|
blackhawkmx Smarty Regular
Joined: 20 May 2005 Posts: 76
|
Posted: Wed Oct 15, 2008 4:24 pm Post subject: |
|
|
i got it!
Code: |
function changelink($output, &$page)
{
return str_replace('index.php?page=', '', $output);
}
$page->register_outputfilter('changelink');
|
and that should match every nav link on a site look identical to how mod_rewrite is displaying nav links _________________ Bring it back to basics. You and I can make it right! |
|
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
|