Jump to content

Recommended Posts

Posted

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

Posted

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

 

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...