Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

help with outfilters

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
blackhawkmx
Smarty Regular


Joined: 20 May 2005
Posts: 76

PostPosted: Thu Nov 20, 2008 5:30 pm    Post subject: help with outfilters Reply with quote

Is it possible to use an outputfilter to mask a url name in the status bar and also in the properties window when clicked on? for example take something like...

Code:

http://mysite.com/item.php?page=one


and mask it to..

Code:

http://mysite.com/one


I have a bases to work from....

Code:

function changelink($output, &$page)
{
 return str_replace('item.php?page=', '', $output);
}
$page->register_outputfilter('changelink');


but I don't want to use str_replace because obviously that will not direct me to the right page in my situation. I simply want to mask the url name - sorta like a replacement name.

thanks for the help
_________________
Bring it back to basics. You and I can make it right!
Back to top
View user's profile Send private message
frode
Smarty n00b


Joined: 21 Nov 2008
Posts: 4

PostPosted: Fri Nov 21, 2008 2:42 pm    Post subject: Reply with quote

Well, if I understood your question correctly and you're willing to use javascript, you could simply point the links to mysitedotcom/one and have an onclick event set window.location to mysitedotcom/item.php?page=one. That way the link/status/properties would appear to send you to mysitedotcom/one, but in reality take you to mysitedotcom/item.php?page=one.

Of course, since you're asking this in a Smarty forum, you could use an output filter to append the onclick event if you wanted to.

This wouldn't be very pretty though. The more elegant way IMHO is to simply have the links point to mysitedotcom/one and use Apache's mod_rewrite to rewrite the urls to mysitedotcom/item.php?page=one. No need to bother Smarty with it at all.
Back to top
View user's profile Send private message
blackhawkmx
Smarty Regular


Joined: 20 May 2005
Posts: 76

PostPosted: Sat Nov 22, 2008 2:37 pm    Post subject: Reply with quote

yeah, thanks for the good tip!
_________________
Bring it back to basics. You and I can make it right!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP