Layouts data and the share .dba files
This page is for developers who change the layouts of the default sites, and for administrators and hosts who wonder
where a fresh installation's layouts come from. It answers: which files carry the explayouts_* rows, how the
installer loads them, and how it fits them to the content of the new installation.
Contents
- Not in the packages
- The files
- What the theme seed contains
- How the installer loads them
- Fitting the rows to the new installation
- The default admin layouts
- Changing the seed
Not in the packages
None of the five sevenx_multisite packages carries a layout. A content package installs classes and objects; the
layouts, zones, blocks, collections and rules of the explayouts extensions live in tables of their own. The
installer creates and fills those tables in preInstall(), before the content packages are installed, from .dba
files that the extensions ship in their share/ folders.
Note
The file extension/expsite_data_media/data/data.sql is deprecated and unused. The source of the layouts of a new
installation is the share/*.dba files described here.
The files
| File | Contents |
|---|---|
extension/sevenx_themes_media/share/db_schema.dba | the tables explayouts_block, explayouts_block_parameter, explayouts_collection, explayouts_collection_item, explayouts_collection_query, explayouts_layout, explayouts_rule, explayouts_rule_condition, explayouts_rule_target, explayouts_zone, eztags, eztags_attribute_link, eztags_keyword, ezurl, ezurl_object_link, ezstarrating, ezstarrating_data, ezpdf_export |
extension/sevenx_themes_media/share/db_data.dba | the rows of those tables (all but ezpdf_export) |
extension/explayouts/share/db_schema.dba | the same ten explayouts_* tables plus explayouts_share, the three eztags* tables, ezurl, ezurl_object_link and exp_info_collection |
extension/explayouts/share/db_data.dba | rows for its tables |
extension/explayouts/share/fragments/admin_layouts_db_data.dba | the default admin layouts, see below |
extension/explayouts/sql/<engine>/ | schema.sql for mysql, pgsql, postgresql, sqlite and oracle, schema.json for mongodb, and data.sql for oracle |
A .dba file is a PHP file with a var_export()ed array ($schema or $data) that eZDbSchema::read() loads; each
table has a fields list and numbered rows.
What the theme seed contains
Counted in extension/sevenx_themes_media/share/db_data.dba as it is in 6.0.15:
| Table | Rows |
|---|---|
explayouts_layout | 21, all with status 2 (published) |
explayouts_zone | 101, of which 38 are linked to a shared layout (36 to layout 2, 2 to layout 7) |
explayouts_block | 342 |
explayouts_block_parameter | 3648 |
explayouts_collection, _item, _query | 70, 59, 48 |
explayouts_rule, _condition, _target | 20, 7, 22 |
eztags, eztags_keyword, eztags_attribute_link | 31, 31, 264 |
ezurl, ezurl_object_link | 321, 495 |
ezstarrating, ezstarrating_data | 1, 0 |
The two shared layouts (shared = 1) are "Header / Footer" (id 2) and "Prefooter" (id 7). The other layouts include
"Default Layout", the "Full / ..." layouts for articles, recipes, topics and videos, the landing pages of Fit &
Healthy, "Showcase", and the "Bold Agency - ..." layouts. How shared layouts and linked zones work in the editor is on
The layouts editor.
How the installer loads them
preInstall() runs dropExtensionTables() and then insertDBFile( package, extension, loadData ) for each entry of
extensionSchemas() (see Extensions it activates). For the layouts the
order is what matters:
sevenx_themes_media, schema and data. It comes first: "its schema and data carry the layouts, tags and ratings of the demo content". Its tables are created and its rows inserted.ezstarrating,ezgmaplocation,eztags, schema only.explayouts, schema and data.insertDBFile()leaves out every table that already exists, "with their data, instead of failing 'already exists'". So the tenexplayouts_*tables, the tags and the URL tables keep the theme's rows, and only the tables the theme does not declare (explayouts_share,exp_info_collection) are created here.
Details of insertDBFile():
- The extension's files are looked for in
<package path>/ezextension/<extension>when a package of that name is in the package repository, else inextension/<extension>(extensionBasePath()). - Before inserting,
dropExtensionTables()drops every table any of these schemas declares. Because the theme's schema declaresezurlandezurl_object_link, those two tables are recreated with the theme's rows as well. - When
eZDbSchemahas no handler for the database, the engine's files insql/<engine>/are used:mysql.sqlorschema.sql,postgresql.sqlorschema.sql,sqlite.sqlorschema.sql,schema.sqlon Oracle,schema.jsonon MongoDB (directorymongodb), thendata.sqlordemocontent.sqlfromsql/<engine>/orsql/common/. createMissingSchemaTables()then creates any declared table that the schema insert left out and reports the ones it cannot create.
Fitting the rows to the new installation
The seed was written against the node and object ids of the reference content. After the content is installed,
post-install step 35 (sevenxFixPackageNodesAndExplayouts() in post-install-fix.php) maps each package id to the id
the new installation gave that node or object, and classifies every reference as mapped (rewritten), base
(base data such as node 1, kept) or missing (content the package does not ship, removed):
| Table / column | Mapped | Missing |
|---|---|---|
explayouts_rule_target.target_value (types content_node, ibexa_subtree, subtree, node) | rewritten | row deleted; a rule left without targets is disabled |
explayouts_collection_item.value_id (ez_location, ez_content) | rewritten | row deleted |
explayouts_collection_query.parameters (parent_location_id, topic_content_id) | rewritten | set to 0 |
explayouts_block_parameter content | rewritten | emptied |
eztags_attribute_link.object_id | rewritten | row deleted |
With the full demo content nothing is missing; with sevenx_multisite_democontent_clean these removals are what keep
the layouts from pointing at unrelated objects. Later steps finish the job: step 40 switches off title-block links
(explayouts_block_parameter link, use_link) to paths that do not resolve, and the resolver cache is cleared
(expLayoutsResolver::clearCache()). The ezstarrating row of the "Test Product" is re-keyed in step 5, with its
average restored to 4.3 because "a .dba cannot carry a fractional one".
The default admin layouts
Step 36, postInstallImportAdminLayouts(), loads extension/explayouts/share/fragments/admin_layouts_db_data.dba:
three layouts with ids from 100001, "Admin: left, main, right" (admin_3col), "Admin: left, main" (admin_2col) and
"Admin: main only" (admin_full), with their zones, blocks and six rules. It does nothing when an admin layout already
exists or the fragment is missing. The admin4l design builds the administration pages from these layouts; see
admin4l.
Note
The fragment's own header comment still says "Prepared fragment: NOT read by the installer". That comment predates step 36; the installer does read it.
Changing the seed
- Edit the layouts on a working installation, then export the tables back into the theme's
share/db_data.dba. The seed of 6.0.15 holds published layouts only (everyexplayouts_layoutrow hasstatus2); a draft is one editor's work in progress and does not belong in it. - Never review a
.dbachange by its text diff: removing one row renumbers every row after it. Compare the files row by row instead. - Test the result with a full install into a throwaway database; see Testing in a sandbox.
Related pages
- sevenx_multisite
- Post-install fixes
- The multisite installer script
- Changing classes and content
- Site packages: start here
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.