Modx same menu items for goods. Bagator_vneve MODX menu with Bootstrap victories. Yak nalashtuvati dynamic visnovok menu structure

It's not for us;).

We can destroy everything from scratch. What do we (me) want to know, and are we ready for options? That is so much more fitting for me. To that, I vvazhayu pіdkhіd most vіrnim. To that, if you can break your own, you can easily get into someone else's code, change, correct the pardons, or add it with the necessary functionality in a specific way. That th, vreshti-resht, make your own - it is most often so acceptable!

Farther, inform your mother on your behalf, that the reader is less aware of PHP programs. Theoretically, those people, who do not understand the code, can copy the code and do all these things about them below. However, perhaps, for them it would be more beautiful to get ready snipets a la Ditto, the odd bit of stench will create a bunch of possibilities for a new configuration, not going to the main code.

I don’t want to debate on the topic, which is more beautiful for a koristuvach - brothers are ready to break their ... Especially for fewer pluses, other options are larger. It is also the case for the reader to start reading it himself.

Otzhe, let's take a look at ours. Oscillations of new software parts in our site are enough to fill, but to fix it is necessary, it is programmed ...

Top menu

With the term "top menu", I pick up the list on the side of the upper part of the site (div. Malunok lower):

I will describe the first butt of the snippet stem in a second lecture, in the following I will mainly focus on the most important details.

According to our tree, the site in the management system, like we were in the foreground statty:

You can see the yak from the baby, in the tree of the site you can see some documents (like "Blog", "About authors", "Photos" that Zvorotn_y zv'yazyk"), Yaki and enter the next menu in the upper menu.

I’ll guess that we have already grabbed the documents in advance, as I don’t want to show them in the menu. For example, in the settings of the document with the name "Poshuk on the site" they cleaned up the great-priest "Show in the menu", and then two documents "Possibility" and "Categories" were lost on the website, having cleaned up the great-priest in the settings of the document "Publikuvati" "in document settings).

In such a rank, the top menu in the control system was prepared in the previous statti.

Let us proceed now to the presentation of our diy bezposeredno on the site.

Most of the programs on the site "", So it’s okremi shmatki code (it is also possible to change things like okremi functions or programs) in PHP. If you implement a top menu item in MODx, we also have to set a new snippet by programming and adding a custom snippet to a template in the required misc.

Go to the management system, see the tab "Resources" -> "Manage resources" -> tab "Snippets" and on the strength of the "New snippet". In the "Name of the snippet" field, write "TopMenu" without paws and just save the empty snippet without a code. Write the name of our snippet on the tab "Snippet".

I guess, in our template in the top menu, we were vines in the "TOPMENU" chunk. Let's move on to the tab "Chankі" and віdkryamo Chank "". In the middle of the chunk, there is also an offensive code:


  • Blog

  • about the authors

  • photographs

  • Zvorotn_y zv'yazyk

Tsei code yakraz i open our menu. Let's comment on the first and second dodamo wiki of the "TopMenu" snippet in the chunk:


[]

Here I will have a chance to see it, so you can explain the zmist of the construction []. On the right, in the form of [] or [! SnippetName!] We can work with snippets wikis in any kind of your templates, chunks and just navigate to any other site.

When the construction [] means a wiklik keshuvalnogo snippet, so that the wiklik with dynamic pidprograms, the result of the wiktion will be made once, and then, if the page is locked, the danny snippet will be wiped out, the result will be invisible, so there will be no repeated wiki in the snippet. In such a rank, the economy of the resources of your web server (and the price is even more important when there is a high visibility of the resource).

However, you should be aware of the situation, if you need to rewrite the snippet code for the whole hour, and you cannot cache the results. Such vypadkami vikoristovutsya constructions [! SnippetName!], Yaka is waiting to snippet snippet without keshuvannya. For an analogy, a design is given to be called a wiklik uncached snippet.

Already, the "TOPMENU" chunk is saved and the site is canceled. Hmm, yak is not marvelous, the top menu is waning. Ale chi is so wonderful for good reason? Having commented on the HTML code of the menu in the chunk, we grabbed its display in the browser (reverse it by looking in output code HTML sidelines). And our snippet "TopMenu" is not to spoil anything, there is nothing left in it. Correctly short :).

Let's move on to the "Snippets" tab, the "TopMenu" snippet will be shown and I will try to protest this possibility ...

For a cob, we can write the simplest code (very simple PHP code):

echo "Testing ...";
?>

Before saving, we vibrate "Proceed with Reduction", so that we will have to change more than once instead of our snippet, and write the snippet in a safe way. It’s just the site’s side, and more on the menu top menu ... well, in truth, apparently, at first glance, it’s not overwhelming for any changes, except for the slightly expanded blue background of the menu. At the same time, "CRTL + A", you can see all the text on the side of the site, and by the way, after all, our snippet in the menu is the text "Testing ...", just color the text with a color to the background.

Snippet code for offensives:

echo " Testing ...";
?>

Now it’s clear, bachimo, that snippet of our pratsyuє and navit (!) Well, it’s fine, it’s a little overshadowed for our tasks, we’ll ask for some fault, but our snippet will display the control system, and in exactly the same HTML code, which was commented in the "TOPMENU" chunk.

And again, the availability is not great ...

The whole system of interconnection of documents in MODx is motivated by the principle: the skin "father's document" is to sweep from zero to empty "daughter documents" ("parent" -> "childs").

Leather document in the database of MODx MA s unique unique identifier "ID" - the same number, like in the bows in the tree of the site for leather documents.

Before the speech, it seems that a unique identifier is not more than one meaning - it is uniquely viznacha a specific document in the management system and nothing more! Specially naughty on the whole fact, there are some examples of ideas in different ways. On them vzagal not varto beasts are rich in uvagi, as a rule, the figures are victorious just for the generation to try to sing documents.

The database MODx also has a special "parent" field for the skin document. The values ​​of this field are a number that denotes either a unique identifier of the Batkiv document, or, if the document is located in the roots of the tree, zero. With such a rank, it is possible to unambiguously signify a document itself є for a given father.

For the sake of sightseeing those who were talking about it at once, open phpMyAdmin, select your database and know the table (PREFIX) site_content, de (PREFIX) - your prefix, which you entered during installation. You can change the fields, in which data of documents are stored, including "ID" - a unique identifier, "parent" - the number of the Batkiv document, "pagetitle" - the header of the page and the inside.

Also, I will give information about the principle of securing and linking of documents in MODx, we can see how to correct the required data for the top menu: we need to know in the database of the data tree all the documents that "parent" is zero.

vikoristovuchi SQL mov, The additional power is described like this (You can try to enter the data into the SQL input field in phpMyAdmin, having replaced "modx_" with your prefix):

SELECT *
FROM `modx_site_content`
WHERE `parent` = 0;

However, such a power supply will turn us absolutely all documents from the root of the site, but we do not call it correctly, but from the main source, we can only send documents to those documents, which may be:

  • published status (in the database, the item "published" is displayed, meaning = 1 means that the document is published, and value = 0 means unpublished).
  • invisible (the field "deleted", de 1 - forcibly, and 0 - not seen),
  • for those who have the option "Show in the menu" (field "hidemenu", de 1 - show in the menu, and 0 - show in the menu).

In addition, if you run the trochies forward, you can immediately view the document according to the "Position in the menu" parameter, as if you would start the position of the skin in our menu.

Well, from the point of view of SQL, it’s awkward to work and look like this:

SELECT *
FROM `modx_site_content`
WHERE `published` = 1
AND `parent` = 0
AND `deleted` = 0
AND `hidemenu` = 0
ORDER BY `menuindex` ASC;

Theoretically, all SQL can be stored in a snippet without a middle with PHP scripts, switching on the skin once the base of the given again and the shitless routine operations that are repeated once every time ... Hey, wait a minute, the price of the framework has changed, which is insanely good for our control system, which has its own We have a ready-made set of software interface (API, Application Programming Interface). API - a whole range of software functions, such as unifying and lulling a lot of data processing processes.

Vikoristovuєmo one of the guessed functions of the API "getDocumentChildren" in our snipet. The function "getDocumentChildren" will remove the parameters in the next date from the viewer:

  • $ Id - number of the Batkiv document,
  • $ Active - select only published or unpublished documents (1 or 0 as per),
  • $ Deleted - select only available or unseen documents (1 | 0),
  • $ Fields - fields that are selected from the database,
  • $ Where - special minds, tobto mind WHERE in SQL feed,
  • $ Sort - the field for which the results are sorted
  • $ Direction - direct sorting, you can accept ASC or DESC values, so sorting from less to great value chi nawpaki
  • $ Limit - interchangeable supply, so that there is LIMIT in SQL supply

$ Results = $ modx-> getDocumentChildren (
$ Id = 0,
$ Active = 1,
$ Deleted = 0,
$ Where = "hidemenu = 0",
$ Sort = "menuindex",
$ Dir = "ASC",
$ limit
);

Print ("

Foreach ($ results as $ key => $ value) (
print_r ($ value);
}

Print ("");
?>

Save snippet and update page. In the result of displaying the updated "TopMenu" snippet, browse the list of arrays and values, sorted by the values ​​of the "menuindex" field from the smallest to the largest. Try to remember the parameter $ dir = "ASC" to $ dir = "DESC" - as a result of the array, the first document will be displayed with the highest values ​​of the "menuindex" field.

For programmers with experience, melodiously, soundly, and rejecting the result, everything is still needed, so that a menu is ready to be prepared. Well, that's all. Anyway, I'll sell it to anyone: the PHP code will be rewritten, so it will be as close as possible to the bazhany result.

$ Results = $ modx-> getDocumentChildren (
$ Id = 0,
$ Active = 1,
$ Deleted = 0,
"Id, pagetitle, published, menuindex, deleted, hidemenu, menutitle",
$ Where = "hidemenu = 0",
$ Sort = "menuindex",
$ Dir = "ASC",
$ limit
);

$ Items = "";
$ Output = "";

Foreach ($ results as $ key => $ value) (
$ Items. = "


  • ". $ Value [" pagetitle "]."
  • \ N ";
    }

    If ($ items! = "") (
    $ Output = "

      \ N ";
      $ Output. = $ Items;
      $ Output. = "
    \ N ";
    }

    Return $ output;

    We will not go into details of the code, there are some extraordinary PHP code, not more than that. I would like to ask you in the comments, but more beautifully - on the general forums of the editorial board.

    Save new snippet code as well as rewrite. As a result, the application of codes is practically practical for those who wanted to correct:

    In order to automatically generate the data, the structure of which will repeat the structure of documents in the MODx tree. To reconsider, try putting some test document in the root of the site and update the side.

    However, not all of them. Bagato was already melodiously remembered, scho posilannya є, ale posilan dumb ... Paradox :). I say uvazi, what do you name the documents in the menu vivodat, protesting on them do not work. So it is logical, some of them left in the code, try to replace "#" real nobles.

    You need to know about one side cinnamon powder MODx: the addresses of any internal side of the site can be recognized for additional offensive design [~ id ~], de id is a unique number required document, Tobto the same number, instructions in the bows of the order with the name of the skin document in the tree of the site. In such a rank, having added such a construction [~ 1 ~] to the template / Ankara / vmіstі storinki,

      • index - the alias of the "Blog" document, when you entered "index", which is the alias of the document, or
      • 1.html, I did not enter anything in the field "I am koristuvach" for the document "Blog"
    • If friends are enabled, then the text index.php is more important? id = 1

    Rewritable snippet, victorious information:

    $ Results = $ modx-> getDocumentChildren (
    $ Id = 0,
    $ Active = 1,
    $ Deleted = 0,
    "Id, pagetitle, published, menuindex, deleted, hidemenu, menutitle",
    $ Where = "hidemenu = 0",
    $ Sort = "menuindex",
    $ Dir = "ASC",
    $ limit
    );

    $ Items = "";
    $ Output = "";

    Foreach ($ results as $ key => $ value) (
    $ Items. = "


  • ". $ Value [" pagetitle "]."
  • \ N ";
    }

    If ($ items! = "") (
    $ Output = "

      \ N ";
      $ Output. = $ Items;
      $ Output. = "
    \ N ";
    }

    Return $ output;

    In this rank, we changed # to [~ ". $ Value [" id "]." ~], That is, in fact, for a skin document, the unique ID of the entire structure [~ id ~] is provided in the array. As a result, we will accept a menu with excellent facilities.

    We have practically reached the ideal ... However, now there is one detail missing, as it is necessary to make a connection: the designer has made a decision, but it is more active for us to be guilty of being guilty in the background and the colors of the reminiscence of the future events.

    Let me ask you for it, I know the secrets of MODx CMS :). The API contains the $ modx-> documentIdentifier function, which rotates the value of the unique identifier of the stream side. We will be familiar with the following for the active side and the vision in the menu:

    $ Results = $ modx-> getDocumentChildren (
    $ Id = 0,
    $ Active = 1,
    $ Deleted = 0,
    "Id, pagetitle, published, menuindex, deleted, hidemenu, menutitle",
    $ Where = "hidemenu = 0",
    $ Sort = "menuindex",
    $ Dir = "ASC",
    $ limit
    );

    $ Cid = $ modx-> documentIdentifier;

    $ Items = "";
    $ Output = "";

    Foreach ($ results as $ key => $ value) (
    if ($ value ["id"] == $ cid) (
    $ Active = "id = \" active \ "";
    }
    else (
    $ Active = "";
    }
    $ Items. = "
    ". $ Value [" pagetitle "]."
    \ N ";
    }

    If ($ items! = "") (
    $ Output = "

      \ N ";
      $ Output. = $ Items;
      $ Output. = "
    \ N ";
    }

    Return $ output;

    Well yak, did you find it? It’s gone!

    Didn't Ale V think about how to end it all? First of all. We set the bar, we want to hit the maximum of MODx's possibilities. And to that one more small detail, they lost it.

    We will respectfully numb the names of the fields that will be powered by the additional function getDocumentChildren: "id, pagetitle, published, menuindex, deleted, hidemenu, menutitle". Among them is є also a field, yak "menutitle". Yak vipliv s name, in this field you can get menu title... In control systems, there is also an entry field "Menu item". The whole field is not binding. However, the logic is that as soon as the field is memorized, then we are guilty of replacing the text according to the order in the menu by yourself. Well, it's so brutal:

    /********************************
    Name: TopMenu
    Meta: Top Menu Visnovok
    Project: Demosite MODx
    ********************************/

    $ Results = $ modx-> getDocumentChildren (
    $ Id = 0, // ID of the father's document
    $ Active = 1, // Vibrate only published documents
    $ Deleted = 0, // Vibrating only unseen documents
    "Id, pagetitle, published, menuindex, deleted, hidemenu, menutitle", // Vibrating fields from the database
    $ Where = "hidemenu = 0", // Vibrate only for documents that are required to be published in the menu
    $ Sort = "menuindex", // Document sort by the menuindex field
    $ Dir = "ASC", // Document sort by growing
    $ Limit = "" // Interference cannot be set (LIMIT parameter in SQL feed)
    );

    $ Cid = $ modx-> documentIdentifier; // accept the ID of the stream side

    $ Items = "";
    $ Output = "";

    Foreach ($ results as $ key => $ value) (
    if ($ value ["id"] == $ cid) (
    $ Active = "id = \" active \ "";
    }
    else (
    $ Active = "";
    }
    if ($ value ["menutitle"]! = "") (
    $ Title = $ value ["menutitle"];
    }
    else (
    $ Title = $ value ["pagetitle"];
    }
    $ Items. = "
    ". $ Title."
    \ N "; // select menu items
    }

    // I want to know in the distance I want to be alone menu item,
    // open the HTML code of the menu
    if ($ items! = "") (
    $ Output = "

      \ N ";
      $ Output. = $ Items;
      $ Output. = "
    \ N ";
    }

    // Rotate the result of the robotic snippet
    return $ output;

    Now try to enter the text in the "Menu Item" entry field of any document ... Wonderful!

    P.S. sideways for the current moment vikoristovuyut one and the same template. In general, the templates were actually shown dynamically only the top menu, all the details were left unimportant. We are bound to be engaged in a tsim piznishe, and poki - without a panic;).

    visnovok:

    From now on, another article has come to its logical conclusion.

    Pid bags navchannya:

    • We tried to register in the recognized fields of the introduced documents in MODx and looked at the collection of information in the database;
    • Did you know about the new special constructions MODx: [], [! SnippetName!], [~ Id ~];
    • Have learned about the manifestation of a special API and have become faster with some API functions;
    • І on the basis of qih knowledge we have created a new snippet in MODx!

    Menu generation snippet. You can also substitute Wayfinder, and let you use more parameters.

    For example, in all the menus will be made right from the decals of the fathers, they will be displayed at the same time, as well as with the help of them.

    A hundred years of speed, even when it was first launched, Wayfinder didn’t take too much action, it’s a competent keshuvannyu.

    parameters

    For the suggestions of pdoMenu, we accept the pdoTools parameters and their deeds:

    Name For substitutions describe
    & parents Stream resource List of batkiv for joke results, through whom. how to put & Parents = `0`- the vibrator is not interchangeable. Yakshho id dad to repair from the hyphen, win and the first site will be turned on from the vibrator.
    & level 0 (interlaced) Рівень the menu is generated.
    & resources List of resources for vivedennya in the results, through whom. If the id resource is repaired from the hyphen, the whole resource is turned on from the vibration.
    & templates List of templates for filtering results, through whom. As the id template is repaired from the hyphen, the resource from it is switched on from the vibrator.
    & where array additional parameters vibrators, codes in JSON.
    & displayStart 0 Turn on the display of cob universities in the menu. It’s okay for more than one “parents” to order.
    & context Vibirka obmezhennya according to the context of resources.
    & showHidden 0 Show resources, prikhovani in the menu.
    & showUnpublished 0 Show unpublished resources.
    & previewUnpublished 0 Turn on the display of unpublished resources, like at the koristuvach є on the tse called.
    & hideSubMenus 0 Show inactive menu items.
    & select List of fields for vibrating, through whom. You can insert a JSON row with an array, for example & Select = `(" modResource ":" id, pagetitle, content ")`
    & sortby menuindex Whether it is a field for a resource for sorting, including a TV parameter, where values ​​\ u200b \ u200bin a parameter & includeTVs, for example & Sortby = `(" tvname ":" ASC "," pagetitle ":" DESC ")`... You can add a JSON row with an array of fields. For a vipadkovo variety of vkazhit & Sortby = `RAND ()`
    & sortdir ASC Directly sotuvannya: for spadannyam abo for growing. If there are too many parameters & sortby and & sortdir empty, then the sorting will be in the order of the resources in & resources.
    & limit 0 Fewer vibrating results.
    & offset 0 Skipping results in the ear. It is necessary to vikoristovuvati at the same time explicitly mean & limit
    & checkPermissions It should be noted that it is permissible to convert a corystuvach with vivedenny resources, for example & CheckPermissions = `list`.
    & countChildren 0 The exact definition of a number of daughter resources in the skin category and in the placeholder [[+ children]]. To rob additional power to the database, to the one for the connections.
    & toPlaceholder Even though it is not empty, the snippet saves all the data in the placeholder because it replaces the data on the screen.
    & plPrefix wf. Prefix for displaying placeholders.
    & showLog 0 Show additional information about the snippet robot. Only for authorization in the context "mgr".
    & fastMode 0 Quick chunk processing mode. All non-broken tags (umovi, snipets, etc.) will be updated.
    & cache 0 Keshuvannya results of a robotic snippet.
    & cacheTime 3600 Hour of relevance to the cache, in seconds.
    & scheme -1 The url formulation scheme, passed to modX :: makeUrl (), that are available options required. A special type of uri gives the uri value to the resource, without running the function.
    & useWeblinkUrl 1 Generate resources
    & rowIdPrefix Prefix id = "" for adding the identifier to the chunk.
    & hereId id of the streaming resource for the generated menu. It is necessary to add only if the script itself is not valid, for example, when the menu is inserted from the chunk of the snippet.
    & includeTVs List of TB-parameters for vibration, through whom. by the way & IncludeTVs = `action, time` give placeholder [[+ action]] and [[+ time]].
    & prepareTVs A list of TB-parameters, with files from the media folder, for which you need to generate additional paths. how to get up & PrepareTVs = `1`, All TVs will be prepared for & includeTVs.
    & processTVs A list of TB parameters that need to be processed and updated in the system manager. how to get up & ProcessTVs = `1`, All TVs will be opted for & includeTVs... I trust the robot.
    & tvPrefix Prefix for TV parameters.

    parameters of templates

    The parameters set up the chunks, which are the templates for the menu generation.

    Name describe
    & tplOuter Chunk for the whole menu block. For contributions: @INLINE
      [[+ Wrapper]]
    & tpl Chunk checkout menu item. If it is not specified, then instead of filling the resource it will be opened on the screen. For contributions: @INLINE
  • [[+ Menutitle]] [[+ wrapper]]
  • & tplHere Chunk checkout for a streaming menu item.
    & tplStart Chunk clearance root point & displayStart... For contributions: @INLINE

    [[+ Menutitle]]

    [[+ Wrapper]]
    & tplParentRow The chunk of the dad's registration with sites, which does not fall under the head & tplCategoryFolder. For example: @INLINE
    & tplParentRowHere Chunk of the execution of a flow document, where it is necessary to take revenge on the sites.
    & tplParentRowActive Chunk of registration of batkіv with sites in the active hіltsі menu.
    & tplCategoryFolder A special chunk of the issued category. Category vvazhaєya dad s sites, for which indications there is an empty template or rel = "category" in the link_attributes field.
    & tplInner Chunk is issued for the entire block of menu items. Yaksho empty - bude vikoristovuvati & tplOuter... For example: @INLINE
    & tplInnerRow Chunk for the menu item. For example: @INLINE
    & tplInnerHere Chunk registration of the active menu item.

    CSS Class Parameters

    These parameters set the values ​​of placeholders [[+ classnames]] and [[+ classes]] for other menu items. Placeholder [[+ classnames]] Show only the name of the class without an attribute class = "", On the view from the placeholder [[+ classes]].

    put on

    A special menu item from the root of the site in one ruven:

    []

    Visnovok with victories of singing fathers and reversal of the permissions of the koristuvach:

    []

    Displaying the menu directly from two batkiv, showing the root points:

    []

    Visnovok of two resources of resources with a number of contributions:

    [] `& TplParentRow =` @ INLINE

  • [[+ Menutitle]] ([[+ children]])
  • [[+ Wrapper]] `& countChildren =` 1`]]

    I see you as a reader. At last urotsі mi reminded Troja site with content (), now it's time add everything to the menu, Shcheb koristuvachi could pass to them.

    turn dynamically menu in MODX we will be behind the help of the snippet PdoMenu s package pdoTools... Before you start reading, take a look at the basic documentation.

    PdoMenu Documentation

    parameters

    parameters of templates

    CSS Class Parameters

    Official butt


    You can read the official documentation here. And at once we pick up the most types of wiklicks of the menu.

    wiklik PdoMenu

    Option 1... On a static menu wiklichemo snippet pdoMenu, For all resources in the tree, on the contribution " elements"In the razdіlі snіpety rozgornіt gіlku pdoTools, Dalі push on pdoMenu With the help of the mouse button (trim the button) and drag the snippet in the mouse, if you want to choose a menu, then in the end you will save the necessary parameters and information " take care«.

    Option 2... I'll just hand over the writing wiklik.

    Butt types

    Choose one-liner menu

    For example, we have a custom menu, with an upcoming html layout.

    Viysov axis such code from the wiklik menu:

    • & Parents = `0` - a list of fathers (in my vipadku I will not surround the vibirka, so as I will only vived only one side);
    • & Level = `1` - the value of the contribution (in this vypadku її dumb);
    • & Resources = `2,3,4,5` - a list of resources that need to be added to the menu;
    • & FirstClass = `0` - class for the first menu item (not yakogo);
    • & LastClass = `0` - class of menu item (not tagged);
    • & OuterClass = `top-menu` - class of menu clippings (presented in ul);
    • & HereClass = `current-menu-item` - class for the active menu item (submitted to li);
    • & RowClass = `menu-item` - class of one row of the menu (to be presented in li).

    Dvorivneve custom bootstrap menus

    static html code viglyadaє like this:

    The code for yogo vivedennya will be like this:

    So, in the offensive level, I will give you a couple of additional menu options, based on bootstrap (and, for quiet purposes, without grasping the essence. Well, it's easy.

    At first glance, everything is neat, everything is not so, read the report, the documentation, ask the nutrition in the comments, I will help you.

    You can change the top menu of the MODX keruvannya panel if you remember the order of passing the elements, or if you have grasped the actions of them as singers. You can also add new items to the latest or personal events as you see fit. There are a few easy-to-understand methods that you can use to modify the top menu, and then you can use practical tools.

    Top Menu Concept

    The menu system in Revolution has a completely new architecture. There is not much more special in the Evolution menu system behind the vignette of the names of the items. To set up the menu is not obligatory new system the menu, ale tse rasumіnnya additional help in robots, especially if you choose to create a Personal side of the control panel, access to which will be displayed through the menu.

    Top menu tree

    Go to the section of the top menu System -> Дії and tweak the basics of the menu system. Right-handed tree (Top menu) As soon as you open the cards, then you will see that there is a copy of the top menu. elements Verkhnyaya Rivnya- the ones you see in the upper part of the control panel. There are a lot of containers for food. Skin support in the tree view in the control panel. If you rush to the page, in the Keruvannya panel you can do something (for example, clearing the cache of the site or going to the access control panel). In fact, the items on the top menu can be diamonds, but the items on the top menu are not set in such a rank.

    Those who see it, if you rush into the menu items, actually start here. Yak vi pachite, you can easily reassign those that are displayed when clicking on the menu item, and you can also change, capture or view the items in the menu list. You can also add items in the menu and assignments, which you can use when you click on them. In fact, you can set up a new menu system for the control panel in order to replace the current and development of the menu. Everything can be done without changing the MODX kernel.

    The physical display of the menu can also be set here. It’s not zbig, but all the elements of the menu are in the same order as the stench is roasted at the top menu. As you change it in the tree, the top menu can also change when the side is overwritten.

    The control panel is easy to see, but be safe, don't change it - press the "Skasuvati" button to send them to a glance.

    At the roztashovany right-handed tree (Top menu) click right button on the item "Site" and select the item "Redaguvati" from the drop-down menu. Show up in a dialog box Editing with fields that start the menu:

    im'ya- іm'ya menu item

    describe- description of the menu item

    Diya- specifics of the PHP file, which will be the visitor

    badge - dodatkovy icon for menu item

    parameters- optional $ _GET parameters for URL

    shatter- JS code, like bude vikonaniy

    Access rights- sharing a coma list of required access rights

    Obviously, there are more fields in the "Site" item. Moreover, it’s a container for a pidmіnyu, which is located in a new one. You can see the menu "Site" in the top menu, you can't see it.

    Let’s wonder at the menu that’s going to be robbed. Natisnіt on "Skasuvati" to complete the dialogue, open the section "Site" of the tree of the right panel, click the right button on the menu "Onewit the site" and vibrate "Redaguvati".

    Obviously, in the dialogue window є instead of the fields "Obroblyuvach" and "Access rights". The "Access rights" field tells us that the user cannot visit the menu item, as long as the empty_cache access rights are not available. In the "obrobnik" field there is a real JS code, which will be displayed if you select an item. All the points, in which the action is vikonuyutsya as a diy maut zapovneny fields abo "Diya", or "Obroblyuvach". If the field "obrobnik" is memorized, then the code is displayed, the rosetting in the whole field, and the field "Dia" is ignored. If the field "Obroblyuvach" is not memorized, then the vikonutsya diya from the field "Diya". Change the field "Diya" as an indicator, either to the file-controller, or to one of the files in the tree "Diy", roztashovany evil (as it is possible to specify on the displayed file-controllers). Close the dialogue by pressing the "Skasuwati" button.

    Let's wonder at the option of the menu item from the beginning. Re-add and re-install via the Packet Manager Batcher add-ons, re-enumerate the page and go to the section again System -> Дії... At the distribution "Components" in the right tree (open it, if necessary) with the right button on the Batcher and select "Redaguvati". Now the field "Diya, but not" Obroblyuvach ": batcher - index. Finish the editing dialogue by pressing the" Skasuvati "button.

    The left panel has all the points of the upper level є the vastness of the names. Open the space of the name "batcher" near the tree "Diy". We are guilty poachiti diyu index. Tsia diya, on the yak I will set the Batcher menu, as they were on the right panel.

    It is easy to see how you can navigate through the "Top Menu" tree. The elements in the "Top Menu" tree can be overridden. As soon as you change the menu item in the tree, you can also change the actual top menu, if you want to change it, you will need to re-install the control panel side.

    To add an item to the top menu, you can press the right button, for example, in the area of ​​the tree and vibrate "Add menu item". To add an item to the menu of the upper level, you can also press the button "Add item".

    Menu items can be clicked by clicking on them with the right button and select the item "Vidality". As soon as you see a menu item, instead of the first half of it, you will also be able to see it if you are a daughter. Qia diya є nevorotnim.

    If you want to tidy up a menu item without actually erasing it short version diy), you can capture it by placing it in the "Access rights" field. As long as you still have to be in this field, give someone a new access right. Leave it with the right to access it will have the right to access, as no one has, the menu item will be invisible. You can make it visible again, by way of seeing the given right of access. If you want to show the singing menu item to singing koristuvacham (albeit not all), just open the template of the new policy, to expose only the signs of the right to access for the koristuvach, to open the new policy, I will use it on the whole template, to write down the context list zastosovutsya to qih koristuvacham and apply qiu policy.

    To change the title of the top menu, specify its description. Then go to the section menu System-> Vocabulary management. Viber the space of the "core" and the "topmenu" theme. The list that we will see to take revenge on more than one side, so you can go to the other side, so that you know the topic "topmenu". Know the alternate row for the required element of the menu, two clicks at the most significant and significant changes. Whether there are any changes, as you visit here, there will be a day or two for an updated version of MODX and for a new component of third-party vendors.

    Descriptions of this method will be used only for inserting menu items into the core. For items in the menu of third-party sales, it is necessary to vibrate the different spaces of the names. For example, if you want to change the menu item for Batcher, you will need to change the row of vocabulary management for the space of the batcher.

    Tree "Дії"

    Turn around before the break System -> Дії, Yaksho vi z nyyli. In the left panel click on "index" is lower than "batcher" and select on the Redaguvati list. Nagadaєmo, scho tsya diya, on the yak will put the Batcher menu item on the right panel. You can use the index to be the controller for the whole project, and the space is the name of the batcher. At once we will go to the section System-> Space Name, Mi poachimo, shho a path for the vastness іmenі batcher will be:

    (Core_path) components / batcher

    With a link to the controller, as if you would like to click on this menu item, MODX will open a new path, similar to the following:

    path_space_name + controller_name + .php

    In other words, vazhayuchi, the core is located in the ministry for the changes, MODX ініцію viconanny to the file controller for the address:

    core / components / batcher / index.php

    If you wonder at the whole file, then you just need to put the index.php file in the core / components / batcher / controllers catalog, which will add the Batcher class and start the Batcher in the control panel. A new menu item in the "Components" section will be unsettled, if we will open the correct control panels.

    A lot of menu items in the right panel do not have much freedom to appear in the left panel. It should be taken into account that the paths to the file-controllers are saved in the database of MODX and are not guilty of redaction (take into account the correctness of the fold). The way to go is stored in the modx_actions tables. Skin dia can be done with the identity (ID) and go to the controller. Diya also has an additional URL for contextual-deposit help, if the controller is active and the number of other fields. For the games shown in the "Diy" panel, you can put the ID in the arms of the handbook.

    The addition of a menu item to the tree for any event in the panel of keruvannya is possible, in such a rank, by way of the opening of the menu item in the right panel and by way of the opening of the menu item in the right panel, or by way of adding a sampler. As the controller is already there, you can just vibrate it in the "Diy" menu. If it’s dumb, then you will be guilty of setting it up in the left panel, as it will be ordered to the controller. For example, there is no menu item for opening a new koristuvach, a little bit for a file controller, this item can be easily added to the top menu. In the general view, you only need to set the right-handed menu item and, for the sake of the "core" name, set the security / user / create option. Yak vi rosumієte, item of the top menu, yaky obrobnik, ala not ma vidpovidnogo diy (similar to the menu item "onoviti site") in the tree "Diy". You didn’t need the "Diya" clause, so you should be able to revenge the code for it. Instead of starting the controller, MODX simply displays the code in the checkbox.

    Processing of clues in the menu

    I have a lot of respect for the Index to the vastness of the Name Batcher in the Lviv panel. Great ID. If you rush to the top menu item, MODX will deny the ID. Then, in the control panel, the URL of the whole party is generated. On our website, ID is 79. If there is an onslaught on Batcher in the top menu, then it is in the address row of the browser:

    http: //site/manager/index.php? a = 79

    If you rush to the Batcher menu item, you will be guilty of a similar URL, in which case you will enter the ID of your Batcher index. If the sampler has been supplied with a URL, I will change the visibility of this menu object in the database, the availability of access rights for the visitor for the visitor, I will set the URL to help and visitor update the file controller for the visitor. ).

    Robot from the top menu

    Now, since we know how MODX has changed the menu items that are linked to them, let's modify the top menu in the control panel. Victorious methods to make it simpler and for them you don't need to be smart about the internal mechanisms of the robot and the MODX menu / diyu system.

    Be here safeguards, oh, all your changes will be like and earlier in power and when the site is updated and not easy way turn to the menu for items. Lots of things, as we will be here, easy werewolves, if you just write down the primary structure of the menu before making changes. More brilliantly with a sprinkle to play with MODX installation, Yaka will not be victorious for the whole site.

    Change the order of the items in the menu

    You can change the order of the items in the top menu in the control panel, for any items in your menu. Go to section System-> Діїі Open the right-handed menu tree (under the heading "Top Menu").

    Yak mi z'yasuvali earlier, the tree is the basis of the top menu of the control panel. You can change the order of passing the items in the upper menu by way of pulling. Just browse a menu item, whatever you want to change, press the Misha button tightly, change this, where you need it and let the Misha button go. With this rank, you can change the order of the items in the top menu, for example. You can move items from one page to the bottom. You can also move the items in the top menu by dragging them to the top menu folder. In order to fix the changes, you need to re-enable the control panel side.

    Additional menu items

    It's easy to add a new menu item. Go to section System-> Діїі Open the right-handed menu tree (under the heading "Top Menu"). Viber a part of the menu, until you want to add an item and click on the "Add menu" button (or click on the right button and vibrate "Add a menu item"). Enter the required menu item and press the "Save" button. Please call MODX to enter new items in the "Components" menu, or you can add more items as needed. To see the menu item, you can press the right button on the new and vibrate "View the menu item".

    If you see a new menu item and then rewrite the page in the browser, you can not add your new item to the top menu. Items on the top menu without daughter items and without a request for a sample will not appear on the menu. The axis of the "Components" menu, as you see it in the tree, does not appear in the menu, if you install MODX Revolution as long as there are no components installed.

    In yakosti simple butt Let us set a new menu for the menu, as it will lead you to the most frequent distributions of the control panel. Let's assume that your robot will be able to make frequent visits to the point of setting up the system, registering / editing a document and controlling access. An item of the top menu under the name "My menu" is instantly recognizable, in which, in addition to the marked points. Obviously, we will be able to view the entire robot in the right panel (Top menu).

    Go to distribution System-> Дії and (in the top menu tree) click the "Add menu" button. Enter the name "My menu" and click on the buttons "Save" in the "Im'ya" field.

    im'ya- New document

    Diya- core-resource / create

    im'ya- System adjustment

    Diya- core-system / settings

    im'ya- Access control

    Diya- core-security / permission

    Cross your three new menu items є items in the "My menu" menu. If it’s not so, pull them in the wrong place. You can also change the order of the menu and menu.

    In addition, if you have requested the required rozstashuvannya menu, rewrite the side of the Keruvannya panel in the browser. Check out the new item "My menu" in the top menu, so you can add three submenus, which are guilty of leading up to the latest distributions of the control panel.

    If you want to see what kind of menu item you have set, just go to the section System-> Дії, Click on them with the right button and vibrate "Vidal". A good idea to see all the messages before the item on the main menu, so that the stench is not overpowered in the database.

    Yak take over menu items

    In addition to changing the order of passing items in the menu, you can also capture the right to access, attach to the menu item. Go to distribution System-> Діїі fire up the menu tree right side(See the heading "Top menu").

    Click with the right button on any item or menu item and vibrate "Redaguvati". Show up in a dialog box from the bottom field "Access rights". Be careful not to change any other field.

    As soon as you enter the menu items, see that the "Access rights" field is stored for them, but for the people it is not. It is necessary for you to grow, to capture the field, to lay it down from the one that is stored in the field, which is not.

    As in the field "Access rights" there is a list of access rights, you can set a new access policy (or change the access) for blocking access rights and the menu item for accessing. The whole operation can be a little bit different, some of the menu items in the control panel can be found from the same access rights. we shorten the method There can be additional information in the field of additional specifications for the access rights of the person.

    The "Access rights" field can hide the list of access rights shared by com. Danish menu item to punch only koristuvachi, as all the rights to access are pererakhovani.

    Let's marvel at the butt. Supposedly, you need to capture all of the koristuvachi, behind the blame of koristuvach with the non-interchangeable rights of Super User, see "Management of koristuvachi" in the Bezpeka menu.

    Go to distribution System-> Діїі open the menu tree, and then click with the right button on the sub-item "Manage koristuvachi" and select the item "Redaguvati". The "Access rights" field is guilty of revenge on view_user. We must give you access rights under the name my_view_user_menu. For a complete change of the whole field, just look at the view_user, my_view_user_menu. Cross over, but there are no gaps in the introduction of the Dani. Now, in order to get rid of the sub-item "Managing the criminals", mothers offend the right to access, and some of them have no other right to access (they just thought of it), they didn’t need to know

    For menu items that do not have access rights, the procedure is similar. You just add new credentials for the access rights to the empty field "Access rights".

    Apparently, since we have given our authority the right to access, the super-user does not have the same rights as the "Management of the super-users" menu. In order to fix it, you need to give it access rights. As soon as you plan to see the operation on a real site, before the signs of access rights for the clerk, give the administrator a lot of access rights.

    Oskіlki standard Administrator group in the control panel has been stolen, you need to set up a new template of access policy, so that the right to access and new access policy, I will be based on them. You can put all your rights to access to the whole template of the access policy. In razdіlі Bezpeka-> Access Control click on "Create an Access Policy Template". For dialogue, select the following parameters:

    im'ya : CustomPermissionTemplate

    Group of templates : Admin

    describe :

    Click the right mouse button on the "Dodati dialed" button. In the case of dialose, select the following parameters:

    im'ya : my_view_user_menu

    describe : Access rights for koristuvach menu

    Let's click on the "Access Policy" tab, then click on the "Create Access Policy" button. In the case of dialose, select the following parameters:

    im'ya : CustomPermissions

    Access policy template : CustomPermissionTemplate

    describe : My authority access rights

    Find out on the policy of access "Custom permissions" and vibrate "Redaguvati". Scroll down the list to access right my_view_user_menu and put a checkbox in the order checkbox. Climb on the buttons "Save" on the right in the mountains.

    Now we need to give koristuvachev with non-interchangeable Super User rights and the right to access the access control list by way of a new element. Go to section Bezpeka-> Access control-> Groupy koristuvacha Click on the right button on the "Administrator" group and select "Edit the group of people", click on the "Contextual access" tab and then on the "Add context" buttons.

    context : mgr

    minimal role : Super User - 0

    access policy : CustomPermissions

    At the top menu, vibrate Bezpeka-> Access Control... Nichto can not change a menu item for a vignette of a koristuvach with non-interchangeable Super User rights (also koristuvachiv with a free access policy). If you go to the control panel as one of the editors of the site, the sub-item "Management of koristuvachi" is guilty of being seen.

    back forward