Making Route
How can I do this?
switch($FormValues['Task']){ case 'StoreConfig': foreach ($FormValues As $FormIndex => $FormValue) if(!in_array($FormIndex,array('Task','TransientKey','hpt','Save'))) $Settings['Plugins.MarketPlace.'.$FormIndex]=$FormValue; if(!$Sender->Form->ErrorCount()){ Gdn::Router()->DeleteRoute('^'.C('Plugins.MarketPlace.StoreURI','store').'(/.*)?$'); SaveToConfig($Settings); Gdn::Router()->SetRoute('^'.C('Plugins.MarketPlace.StoreURI','store').'(/.*)?$','vanilla/marketplace$1','Internal'); } break;
Because Im trying to use the members list, But am trying to make it so that instead of pathway /plugin/memberslistehn to /community/members.
Comments
@x00 This is from your Market Place plugin
I don't understand , You want to make a clone of Market Place and call it something else ?
Here is how to make a new Route
http://vanillaforums.org/docs/routes
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
No, I simply want another plugin to have a different route.
coud you elaborate by posting how you think it could be done?
Plugin A is here, but I want to get it from somewhere else? I have trouble with the logic sorry ...
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Simple question: what would you like to route to what? It's not so difficult to do, if you have a clear source and destination in mind.
My shop | About Me
he is trying to :
my logic tells me in order to route something it must be located somewhere specific. Plugins are in the plugin department, in order to change that, the plugin would have to reside in the place you want to call it from no?
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
If I understood your question, not really. I create routes for my plugins all the time, to "prettify" the URLs, and they work well.
Here's a route that should do what @Srggamer wants (untested, but it should work):
Route: ^community/members(/.*)?$
Target: plugin/memberslistehn/?$1
@Srggamer are you sure that it's memberslistehn and not memberslistenh?
My shop | About Me
so Target tells what to fetch and from where?
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
so Target tells what to fetch and from where?
why did I know you were going to say this
the route is what you are reading. the stuff in parenthesis is reinterpreted to $1 and
appended onto the target.
if you shoot an arrow you hit the target - the destination.
@businessdad said:
Route: ^community/members(/.*)?$
Target: plugin/memberslistehn/?$1
good idea @businessdad,
the route changing is easier than writing a new app, but i learned some more app stuff too
@Srggamer
I modifed it a bit and the rest of the changes you need.
Route: ^community/members(/.*)?$
Target: plugin/MembersListEnh/?$1
then change memtable in the views folder in the plugin.
line 31 -
$MColUrl = 'community/members/p1';
line 72 or so
'community/members' . '/{Page}' . '&sort=' . $SortOrder . '&ufield=' .$UserField
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
lol it must be love no? Don't answer that I can't take rejection kindly.....
That is what I gather it means and is why I asked coz the logic is not clear to me.
If I understood the OP (and that I am not sure I do) he wants the opposite .
Maybe I need a flowchart lmao
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
no he want a pretty url. Ya Rastaman vibration. without it saying plugin in the url.
so
http://myforum.com/community/members
instead of
http://myforum.com/plugin/MembersListEnh
also
the lines I added clean up the interior links in the memtable.php, and will work (as long as the route is applied).
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Well when you put it like that it makes total sense ! Thanks for clearing it up then
@Srggamer will be pleased I am sure.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
in Setup()
try
grep is your friend.
You can interpret it like this: when User asks for Route, let's do as if he asked for Target.
They are Regular Expressions and, as @peregrine wrote, the syntax allows you to "tag" parts of the source expression and place it somewhere in the Target one.
@x00 Thanks for adding the code to automatically add the Routes on plugin setup. That's the same I use in most of my plugins, it's indeed so easy.
By the way, I just would like to suggest @Srggamer, and anyone who creates routes for their plugin, the golden rule of "cleaning after yourself". That is, make sure that you delete the Routes when the plugin is disabled.
I'm on mobile and I don't have the code handy, but I think the command should be
Gdn::Router ()-> DeleteRoute ()
, or something like that.My shop | About Me
Thanks @all for these responses I should have used more correct terminology while describing what I wish to accomplish thanks.
PLs document it on the wiki, what you have in this thread
There was an error rendering this rich post.
I dont get what you are saying.
@Srggamer
He wants you to please help document this stuff in the Vanilla Wiki so as to help others in return.
http://vanillawiki.homebrewforums.net/index.php/Main_Page
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Sure,