Jump to content
Sign in to follow this  
Amit Kumar Mishra

is it possible to get two routes in the same config

Recommended Posts

hi developers

i was working on something for blesta, at present you may call it a plugin

where i get stuck is

if i keep can setup two routes

say, in

// Route all except the following to the CMS plugin (if the plugin exists)
if (file_exists(PLUGINDIR . 'cms')) {
    Router::route('^(?!' . $admin_loc . '|api|callback|cron|404|uploads|' . $client_loc . '|install|order|plugin|widget)', '/cms/main/index/$1');
}

the functionalities of my plugin dont serve the pages

now if i put my plugindir . 'mydir' the plugin i am coding is working, but the blesta's own cms portal is not working

what i aim to achieve is the cms (portal plugin to work) and along with it, my plugin to serve a few pages, either static or dynamic

so, i am stuck with how to get both the things to work?

any help from any developers would be highly appreciated

 

thanks

Share this post


Link to post
Share on other sites

the sample way is to configure your custom page with a prefix like /pages/ then add this prefix to the excluded routes then your plugin will handle your pages w sample for your route sould be like this

// Route all except the following to the CMS plugin (if the plugin exists)
if (file_exists(PLUGINDIR . 'cms')) {
    Router::route('^(?!' . $admin_loc . '|api|callback|cron|404|uploads|' . $client_loc . '|install|order|plugin|widget|pages)', '/cms/main/index/$1');
}

Router::route('^pages/(.*)$', '/your-plugin/main/index/$1');

Notes all your plugin links should be begin with the prefix, like

/pages/my-custom-page
/pages/my-custom-page-2
/pages/another-my-custom-page

 

Share this post


Link to post
Share on other sites
On 11/6/2018 at 8:48 PM, Amit Kumar Mishra said:

humm

so far, so good

at least one help..

i will do this and test it ASAP, and update you here, in case there is some issue, and in case i require a bit more guidance

you are welcome.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×