Content
Table of contents
This entity allows you to manage the materials in the system and their types. It is included in the core of the system and provides for the creation, editing and deletion of content - it includes the necessary tools for convenient creation of new publications. The main page is shown below:
- Add - link to the add page;
- Types - link to the content types management page;
- Navigation - links to broken pages;
- Title - displayed title;
- Type - material type;
- Actions - links for editing and deleting are available.
The administration page displays all entries that have been added by users of the system. When you click on the title of the material, you go to the corresponding page.
Adding a material, selecting its type (previously created material types):
Adding material, main form (fields may vary depending on the type of material):
- Title - displayed title of the material, on its basis the address for this material can be generated (for this, the corresponding checkbox must be set, and Cyrillic characters are transliterated into Latin characters);
- Address for material - address for material;
- Content - the content of the material.
After filling in the fields, you must click on the submit button of the form, as a result of which the system will start the validation process - if any values in the fields are invalid, a warning will be displayed with the name of the fields that contain invalid values. In case of successful verification, the material will be added - the newly created page will open. If necessary, you can click on the "Edit" link under the title to edit the page you are viewing.
Manage content types page:
- Add - link to the page for adding a content type;
- Content - link to content management page;
- Name - machine name of material type;
- Title - displayed title;
- Actions - links for setting, changing and deleting are available (in this case, all elements dependent on it will be deleted: materials, fields, field data).
Page for adding a content type (similarly for editing):
- Name - machine name of material type;
- Title - Display title.
Templates
By default, templates are not used for display, content is displayed in a standard form. It is often necessary to be able to flexibly customize the output of a certain type of content, namely, to place fields in different places on the page and in different views. For any type of material, you can create a template that will be used when displaying this type of material.
Templates must be placed in the current theme folder at "/custom/themes/*/templates", where * is the name of the theme. The template must have a name like "content_show_*.tpl", where * is the name of the content type.
Here are the following values:
- content - belonging to the "Content" entity;
- show - action to perform;
- material type name is the name given to the type.
It is enough to create a similar template in the above directory and it will automatically be used when displaying a certain type of material. In the template, you can place the fields as you like, which allows you to draw the output in the desired form. It has an array "data" that contains all the data available for the page. You can view its contents, for example, using the "print_r" function and use the desired values. All features of the PHP programming language are also available in the template. To return to using standard output, you just need to delete the generated template.
Latest articles
- 03.04.24IT / Уроки PHP Уроки простыми словами. Урок 3. Все операторы PHP с примерами, с выводом работы кода на экран.
- 02.04.24IT / Уроки PHP Уроки простыми словами. Урок 2. Типы данных в PHP с примерами.
- 02.04.24IT / Уроки PHP Уроки простыми словами. Урок 1. Коротко о языке веб-программирования PHP. Основы синтаксиса.
- 09.11.23IT / Database Errors when migrating from MySQL 5.6 to 5.7 and how to fix them - database dump import failed with an error or INSERT does not work. Disabling STRICT_TRANS_TABLES strict mode or using IGNORE
- 08.07.22IT / Misc Convert office files DOC, DOCX, DOCM, RTF to DOCX, DOCM, DOC, RTF, PDF, HTML, XML, TXT formats without loss and markup changes