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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...