We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Create a new entry in the admin side menu | Forum

Christophe Tricaud
Christophe Tricaud Feb 21 '20
I am trying to add a shortcut in the admin side menu to go directly to a page concerning a plugin. This page exists but I have to go thru all plugin, select the one I want and click on preference.


I added an entry in ow_base_menu_item but I don't know how the router in the MVC is working, and what I have to do so when I click the new link I go to the right page? The entry is showed on the menu, but I have a 404 error since this route does not exists.


I was wondering if there is somewhere a table of all the routes?


Thank for your help


Christophe Tricaud

Paris, France

Christophe Tricaud
Christophe Tricaud Feb 21 '20
Looking at the code on the route.php, I understand that the generated URI myabe set by ecah substr with a slash.


The URI I want to reac is admiun/plugin/cacheextreme so I tried admin_plugins_cacheextreme with no success

Paul
Paul Feb 21 '20

Hope to understand you question, here is an example


PARTS_CTRL_Tech = class PARTS_CTRL_Tech extends OW_ActionController
a80 = public function a80($params = NULL) 


the path of the controller is = ow_plugins/parts/controllers/tech.php


// For Landingpage:

OW::getRouter()->addRoute(new OW_Route('repair-manual', 'repair-manual/a80', 'PARTS_CTRL_Tech','a80'));



// For the first category

OW::getRouter()->addRoute(new OW_Route('repair-manual-main-page', 'repair-manual/a80/:section_url', 'PARTS_CTRL_Tech','a80'));


// for Subcategories

OW::getRouter()->addRoute(new OW_Route('repair-manual-page', 'repair-manual/a80/:section_url/:chapter_url', 'PARTS_CTRL_Tech','a80'));



Example is working here

https://www.toyota-supra.com/repair-manual/a80

The Forum post is edited by Paul Feb 21 '20
Christophe Tricaud
Christophe Tricaud Feb 21 '20
Funny Paul, I am really interested by your toyata community for one of my client! I just sent the url to him yesterday! Did you developped it?


I quite understand what you say: however I am not developping a plugin but using one that exists. I would like just to add a link in the menu with out programming: I thought this may be done thru the database or the admin panel.


Thanks for your help


Christophe

Paul
Paul Feb 21 '20
Yes, I developed it.



Yes, the menu is working throuh the "base_menu_item" table, which is join the "base_document" table


The Admin menu has 7 definied types (the main categories) it is not possible to create a new one. So you have to add your menu link to one of the 7 types


The routePath (the link) musst be an existing route from a plugin or the core.


EDIT: you can use externalUrl for an static url:



    public function findMenuItems( $menuType )    {        return $this->dbo->queryForList("SELECT `mi`.*, `mi`.`key` AS `menu_key`, `d`.`class`, `d`.`action`, `d`.`uri`, `d`.`isStatic`FROM `" . $this->getTableName() . "` AS `mi`LEFT JOIN `" . $this->documentDao->getTableName() . "` AS `d` ON ( `mi`.`" . self::DOCUMENT_KEY . "` = `d`.`" . BOL_DocumentDao::KEY . "`)WHERE `mi`.`" . self::TYPE . "` = :menuType ORDER BY `mi`.`order` ASC", array('menuType' => $menuType), 24 * 3600, array(self::CACHE_TAG_MENU_TYPE_LIST, OW_CacheManager::TAG_OPTION_INSTANT_LOAD));    }



The Forum post is edited by Paul Feb 21 '20
Attachments:
  adminurl.JPG (18Kb)
Christophe Tricaud
Christophe Tricaud Feb 21 '20
Thank you for your help, it works fine.


Did you use a commercial template or you develop your owns?


Christophe

Paul
Paul Feb 21 '20
It's my own theme, based on simplicity. But there is a lot of customization of basic functions via my own plugins.
Some Funktions were not possible to make via plugins so there a some little changes in the core system. But this website is based on the one core installation using an own plug-in for a bootstrap theme on the main page: www.toyota-supra.by
Christophe Tricaud
Christophe Tricaud Feb 21 '20
Great job!
Patricia Zorrilla Leader
Patricia Zorrilla Feb 21 '20

Christophe Tricaud,

This plugin:

https://developers.oxwall.com/store/item/1685

Do what you want and more, you'll find it very useful

AppXprt
AppXprt Feb 23 '20
Nice work Patricia!