
Two years ago I wrote about the
finished build of an online store on MODX Revolution . During this time, quite a few online stores on ShopModxBox (most of them by third-party developers) were made, and today the number of engine installations is 200-300 pieces per month. The project continues to evolve today, getting new useful functionality into the core.
The main qualities that we note in ShopModxBox are high performance, flexibility and minimal code amount (ShopModxBox is a solution based on the MODX Revolution framework, and its own part of the code is literally 3-5 thousand lines of php code + Smarty templates).
')
And so the other day we released a new build NewsModxBox. Here the basis is the same as in ShopModxBox, only the logic is sharpened just for news portals and media. The assembly was sawn under a real and not at all small news portal and in many respects corresponds to the realities of the business logic of electronic and mixed media.
What, for example, is in NewsModxBox?- Specialized editor of articles. joxi.ru/52a104ZhjqK720 In it, among other things, there is such a thing as creating a new document in a pop-up window. I will say this: it was one of the most difficult tasks in it.
- Custom media manager using a database and direct file uploading. I have already written about it in places, for example, here . Hundreds of people can work with this editor and will not die on hundreds of thousands of files.
- Morphological search. Yes, yes, he works there :) Although twisting may be necessary on each individual project, depending on the specifics.
- Business logic, sharpened by the realities of news portals, with various groups of access, sending for editing, etc.
- Typography texts by Jevix
- Ability to set articles to index links in them or not (if not, all links will be put down rel = "nofollow")
- Ready download in Yandex news and Google news (special full-text RSS).
- Own pagemap.xml for an unlimited number of documents.
- Banner system.
- Tag Cloud.
- Blog-social component.
- Currency and weather widgets.
- Integration with hh.ru (Work section). By the way, all the pages in the Work section are CNC-enabled, and look to search engines as part of the site.
- Crazy technical optimization. The engine is designed for hundreds of thousands of articles. On an average server, it keeps hundreds of users online. Conducted load testing, 75,000 articles and 2,000 online users could not put the server. Pruff joxi.ru/Dr8Ke8OIYgKlA6
- Section for paid subscription materials
- Generate thumbnails from PDF for magazines
- Affiliate links. This is useful when you have any affiliate program. Here is an example: joxi.ru/D2PjRW0SOZqWr3 joxi.ru/eAOqaVNf3K98mo
- Additional headings. That is, the article can be placed immediately in several headings.
- A clever system of news samples and template making that will not allow to randomly display the same news in several places.
- Custom publications. joxi.ru/a2XVypGu8kDerg
- Authorization through social networks.
And much more.
Some technical information.
Software part
Almost all logic is written in processors. About their logic, I
wrote for a long time
here . Since then, their paradigm as a whole has remained the same, but technically they have changed, becoming mostly class-based. Quite a fresh and detailed article about the new processors and used by us
here .
What is the beauty of processors? First, in their extensibility. Do not have to produce duplicate pieces of code. Secondly, in their universality. In MODX, they can be called either directly (from other scripts or Smarty-templates) or through connectors (Ajax-requests, etc.). Third, the convenience of debugging. For example, you can make a selection of articles in the MODX-console.
PHP code for a query in the console<?php print '<pre>'; ini_set('display_errors', 1); $modx->switchContext('web'); $modx->setLogLevel(3); $modx->setLogTarget('HTML'); $namespace = 'modxsite';
An example of the response received. Array ( [success] => 1 [message] => [count] => 3 [total] => 28 [limit] => 3 [page] => 0 [object] => Array ( [86981] => Array ( [id] => 86981 [type] => document [contentType] => text/html [pagetitle] => . . [longtitle] => [description] => [alias] => kopiya-donald-tramp.-iskusstvo-zaklyuchat-sdelki [link_attributes] => [published] => 1 [pub_date] => 0 [unpub_date] => 0 [parent] => 86915 [isfolder] => 0 [introtext] => , . [content] => . , . , . , - , (, , ..). , . [richtext] => 1 [template] => 2 [menuindex] => 5 [searchable] => 1 [cacheable] => 1 [createdby] => 422 [createdon] => 1443280367 [editedby] => 422 [editedon] => 1443280510 [deleted] => 0 [deletedon] => 0 [deletedby] => 0 [publishedon] => 1443225840 [publishedby] => 422 [menutitle] => [donthit] => 0 [privateweb] => 0 [privatemgr] => 0 [content_dispo] => 0 [hidemenu] => 0 [class_key] => modDocument [context_key] => web [content_type] => 1 [uri] => rubriki/books/kopiya-donald-tramp.-iskusstvo-zaklyuchat-sdelki.html [uri_override] => 0 [hide_children_in_tree] => 0 [show_in_tree] => 1 [properties] => [article_type] => [image] => lazy/images/65588288e12ab09ae49c8a6f7552e130.jpg [article_status] => 2 [mssql_id] => [tags] => [pseudonym] => [news_list] => 1 [rss] => 1 [top_news] => 0 [mailing] => 0 [article_genre] => 0 [main] => 0 [fasturl] => [views] => 148 [hide_on_mainpage] => 0 [hide_adverts] => 0 [object_id] => 86981 [tv_27_gallery] => [tv_30_sell_link] => [{"MIGX_id":"1","title":"\u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430 Ozon.ru","link":"http:\/\/www.ozon.ru\/context\/detail\/id\/21419581\/?partner=business-vs-crisis_ru&from=bar","icon_class":"glyphicon-shopping-cart"}] [tv_31_original_source] => [tv_32_hide_image] => [section_title] => [author_avatar] => /assets/avatars/copy.jpg [tvs] => Array ( [sell_link] => Array ( [tv_id] => 30 [value] => [{"MIGX_id":"1","title":"\u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430 Ozon.ru","link":"http:\/\/www.ozon.ru\/context\/detail\/id\/21419581\/?partner=business-vs-crisis_ru&from=bar","icon_class":"glyphicon-shopping-cart"}] ) ) [imageDefault] => /uploads/images/No-Photo.jpg [public_image] => /uploads/lazy/images/65588288e12ab09ae49c8a6f7552e130.jpg [gallery] => Array ( ) [sell_link] => Array ( [0] => Array ( [MIGX_id] => 1 [title] => Ozon.ru [link] => http:
What it looks like in the admin panel At the same time in the call in the $ params variable, you can specify a limit, sorting, search conditions, etc. etc. In the development process, there is no need to reload the page in the front each time to check the result of the code change in the unloading processor. First, we debug everything in the admin panel, and if there is a sample as it should, then there will be the same result in the front. The same goes for commenting mechanisms, publications, feedback forms and everything else.
Templates
Templating is based on Smarty and is perfectly friendly with processors. For example, this is how you can get an array of news and fill them in a loop into the final HTML:
{$params = [ "limit" => 10, "sort" => "pagetitle", "dir" => "DESC" ]} {processor action="web/resources/articles/getdata" ns="modxsite" params=$params assign=result} {if $result.success && $result.object} {foreach $result.object as $object} <p>{$object.pagetitle}</p> {/foreach} {else} <div class="alert alert-danger">{$result.message|default:" "}</div> {/if}
Of course, this is a simple example (in reality, there are extensible patterns, blocks, inclusions, etc.), but in general, it gives an idea of how something is done there. And pay attention to the similarity of the call in the template and the console. Both here and there the path to the called processor (in our case, this is web / resources / articles / getdata) and the optional $ params array parameter are passed.
But perhaps the main advantage of using Smarty is the ability to use several design templates (skins) at once. We have a principle such that there is a basic template (supplied with the assembly), and when on the final site you need to change the design and / or change some logic, you do not need to make a full copy of the skin and completely switch to it, but simply specify an additional skin and already make changes to it. This will not only reduce the number of your own skins, but also allow you to roll up changes to the build itself on an already working site, getting new functionality and not breaking the current layout. Here is a
detailed manual how to do it. There on the example of ShopModxBox, but again, the principles in NewsModxBox are the same.
Where and how to download
Method 1. Installation on pure MODX
Attention!!! Do not install this package on the combat site. This is a snapshot of the full site and it will overwrite the current site. It is installed only on pure MODX.So, the installation process is relatively simple for those who are already working with the MODX Revolution. Put a pure MODX. Then in the package management, add a new repository with the address
http://rest.modxstore.ru/extras/ and download and install the NewsModxBox package from it.
I do not recommend installing MODX versions 2.4.0 and 2.4.1, as there is a very unpleasant bug, a patch for which has not yet been accepted. Better to put 2.3.6Method 2. From the archive.
Method one is convenient, but not on all hosting sites will pass. Firstly, the package weighs 50+ meters, and where memory is little allocated, it may simply not be unpacked. Secondly, the installation does not last two seconds, and the installation process can simply be interrupted by timeout (and on timeweb.ru when the processor is 100% loaded and after five seconds the script is terminated). In this case, for those who are familiar with MODX or just not the first day engaged in web development, the option to deploy a site from a
full dump is suitable. Here the site is packed completely with MODX, there is dump.sql at the root. All that is required is to unpack it, create a database, upload a dump into it and correct the site configs.
Both installation methods are described in detail on the
ShopModxBox download page (there is even a video).
Well, for those who can not or do not want to install the assembly themselves, but I want to see it from the inside, there is a third option - order the installation of a test site from us. Issue price of 300 rubles, the site will be available for a month. It is installed on our hosting and will not require any extra movements from you. The service order form is
here .
Filling
By filling the main points:
1. In the Rubrics section, we add the sections with the Section template that we need. 2. Now sections are available in the news editor itself. There are articles and create / edit. Briefly Pros / Cons of the system
Our policy here is the same as with ShopmodxBox - this build is just for a quick start. In any case, the final projects will have to do something for private business processes. We care not about comprehensive functionality and versatility, but about minimizing the core, performance and flexibility. That is, it is something between a samopiski and CMS. All major projects are trying to write a samispik for themselves, so that everything works as they want. But to write everything from scratch - it makes no sense. Here it is not difficult to add one's own, and it is not necessary to write everything from scratch.
PS This Friday (10/02/2015) at 19.00 in our office at the address Moscow, New Arbat 21, will be held a
master class on NewsModxBox . Only 6 tickets. If anyone is interested, hurry.