XF 2.2 Route instead of class?

Robert9

Well-known member
What I have:

forum.com/doitnow
=> abstract, function doitnow

forum.com/forum.id/doitnow
=> extend class forum, function doitnow

forum.com/thread.id/doitnow
=> extend class thread, function doitnow

Can do now:
Move same code into repository


Can I do instead:
route
forum.com/doitnow => abstract class
forum.com/forum.id/doitnow => abstract class
forum.com/thread.id/doitnow => abstract class

Is this the right way?
 
Last edited:
You can't use an abstract class as a controller - it simply won't work as an abstract class can't be instantiated.
 
Probably wrong used words ...

This works for me ...

Code:
namespace Robert9\FastSearchThreads\Pub\Controller;

use XF\Pub\Controller\AbstractController;

class FastSearch extends AbstractController

... with this route

Code:
  <route route_type="public" route_prefix="fastsearchthreads" controller="Robert9\FastSearchThreads\Pub\Controller\FastSearch"/>


But I have also
../forums.id/fastsearchthreads
../threads.id/fastsearchthreads

the question is if i can route this urls to the class above,
or do
class Thread extends XFCP_Thread
class Forum extends XFCP_Forum

I dont want to have the same code three times.

If route is no good idea to use one class for the function,
I have to move the code in a repository, right?

Finally, i need three times
Code:
find threads where blabla

I will try this now.
 
Back
Top Bottom