Lesson 1.1: The developer's map of an installation
Before learners write a line of code, they need to know where things live and which folders are theirs. This lesson walks through the top-level folders of an installation, sets the two rules the whole course follows, and shows how a page address leads to the code that makes it.
Note
Use a development or training installation for every exercise in this course, never a live site.
At a glance
| Course | Developers |
| Module | Module 1: The development installation |
| Duration | 45 minutes (20 presenting, 25 exercise) |
| Level | Beginner |
| Audience | PHP developers new to Exponential |
| Prerequisites | A shell on a machine with an installation; basic PHP and Git |
Learning objectives
After this lesson, learners can:
- name the purpose of
kernel/,lib/,settings/,design/,extension/,var/,bin/php/andautoload/; - state the two rules: read the kernel, do not edit it; your work lives in
extension/; - find the module and the view behind an administration address such as
/content/view/full/2; - find the file of a kernel class through the autoload map.
Trainer's notes
How to present it
Source: Reading the code you already have and What an extension is.
History in one sentence (2 minutes). Exponential continues the code base of eZ Publish, which its creator discontinued after almost 18 years. Kernel identifiers keep their historical names (
eZINI,eZContentObject,ezinfo.php); new code of learners uses their own prefix, neverez.The map (8 minutes). Run
lsin the installation root on the projector and go through the table below. Stress the third column.Folder What is in it Do you change it? kernel/One folder per kernel module and kernel/classes/, the content modelNever. Read it. lib/The libraries: ezdb/,eztemplate/,ezutils/,ezfile/...Never. Read it. settings/Default .inifiles;settings/override/andsettings/siteaccess/<name>/hold this installation's ownOnly through overrides, siteaccess settings or extensions design/The kernel's designs: standard,admin4,editor...Never. Override in your own design extension extension/Every extension, one folder each Your own extensions, yes var/Caches, compiled templates, logs, uploaded files Never by hand, except to read logs bin/php/Command line scripts, run by name through the console Never. Yours go in extension/<yours>/bin/php/autoload/Generated class maps Never; regenerate them tests/The kernel's test suites Read them: they are executable examples doc/The documentation Improve it with a pull request The two rules (3 minutes). The kernel is replaced at every upgrade, so edits there are lost. An extension plugs into places the kernel was built to look: settings, directories, the design chain and events.
From an address to the code (5 minutes).
/content/view/full/2is the modulecontent, the viewview, with the parametersfulland2. Showgrep -n "ViewList\['view'\]" -A6 kernel/content/module.php.From a class name to its file (2 minutes).
grep -n "'eZContentObjectTreeNode'" autoload/ezp_kernel.php.
Common questions
Why can I not just fix a bug in kernel/? You can, as a pull request to the project (lesson 13.3). On your own
site the change would be lost at the next update; carry it in an extension, or get it into the kernel.
Where do uploaded images go? Below var/ (for example var/<site>/storage). Never edit them by hand.
Is vendor/ part of the kernel? No. It holds Composer libraries such as the expcomponents (the fork of the Zeta
Components). Do not change it
either.
Pitfalls
- Editing a file in
design/standard/. It works until the next update. Point learners at overrides (module 3) from the start. - Searching
var/for code. Compiled templates invar/look like PHP and confuse beginners. Excludevar/from searches:grep -rn --exclude-dir=var .... - Old tutorials. Many tutorials on the web were written for older releases. Check every name they use against the code of the installation.
Hands-on exercise
Use your development installation from the root folder (the one that holds index.php).
List the top-level folders:
ls.Count the extensions on disk:
ls extension/ | wc -l.Show the definition of the content module's
viewview:grep -n "ViewList\['view'\]" -A6 kernel/content/module.phpWrite down the name of the script the view runs.
Find the file of the class
eZContentObjectTreeNodethrough the autoload map:grep -n "'eZContentObjectTreeNode'" autoload/ezp_kernel.phpFind the line where
fetchByNodeIDis defined in that file:grep -n "function fetchByNodeID" kernel/classes/ezcontentobjecttreenode.phpShow the last three commits that changed the file:
git log --oneline -3 -- kernel/classes/ezcontentobjecttreenode.php.Pick one page of the administration you know. Write down its module, its view and its
module.phpfile.
Expected result
- Step 3 prints the
$ViewList['view']entry with'script' => 'view.php'and its parameters. - Step 5 prints one line mapping the class to
kernel/classes/ezcontentobjecttreenode.php. - Step 8: every learner has three paths written down. The trainer checks two learners' paths on the projector by opening the files.
Quiz
- Which folder holds the work of a developer of a site?
A.
kernel/B.design/standard/C.extension/D.var/ - What do the parts of
/content/view/full/2mean? - True or false: the files in
autoload/are written by hand. - Why should a search for code exclude
var/? - Which prefix may the class names of a learner's new extension not use?
Answers
- C. Your own extensions live in
extension/; the kernel is replaced at every upgrade. - Module
content, viewview, parametersfulland2(a view mode and a node ID). - False. They are generated with
php bin/php/ezpgenerateautoloads.php. - It holds caches and compiled templates that look like code but are generated.
ez: it belongs to the kernel's existing classes. Useexpor your own prefix.
Further reading
- Reading the code you already have: the four techniques for finding code.
- What an extension is: the folders inside an extension and the switch that turns it on.
- The ladder from user to developer: where this course fits.
Related pages
- Module 1: The development installation
- Developers: course overview
- Trainers: 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.