Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions application/bg/how-it-works.texy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
│ │ ├── <b>HomePresenter.php</b> ← клас на презентера Home
│ │ └── <b>default.latte</b> ← шаблон на действието default
│ └── <b>Bootstrap.php</b> ← зареждащ клас Bootstrap
├── <b>assets/</b> ← ресурси (SCSS, TypeScript, изходни изображения)
├── <b>bin/</b> ← скриптове, стартирани от командния ред
├── <b>config/</b> ← конфигурационни файлове
│ ├── <b>common.neon</b>
Expand All @@ -40,6 +41,7 @@
│ ├── ...
│ └── <b>autoload.php</b> ← autoloading на всички инсталирани пакети
├── <b>www/</b> ← публична директория или document-root на проекта
│ ├── <b>assets/</b> ← компилирани статични файлове (CSS, JS, изображения, ...)
│ ├── <b>.htaccess</b> ← правила mod_rewrite
│ └── <b>index.php</b> ← първоначален файл, с който се стартира приложението
└── <b>.htaccess</b> ← забранява достъпа до всички директории освен www
Expand Down
6 changes: 6 additions & 0 deletions application/cs/ajax.texy
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,9 @@ public function handleFoo(int $bar): void
{
}
```


Další četba
===========

- [Dynamické snippety |best-practices:dynamic-snippets]
17 changes: 17 additions & 0 deletions application/cs/creating-links.texy
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ Odkazy generované pomocí `link()` nebo `n:href` jsou vždy absolutní cesty (t

Pro vygenerování absolutní URL přidejte na začátek dvě lomítka (např. `n:href="//Home:"`). Nebo lze přepnout presenter, aby generoval jen absolutní odkazy nastavením `$this->absoluteUrls = true`.

V šabloně lze také použít filtr `|absoluteUrl`, který relativní cestu převede na absolutní.


Odkaz na aktuální stránku
=========================
Expand Down Expand Up @@ -179,6 +181,21 @@ Pro zjištění, zda jsme v určitém modulu nebo jeho submodulu, použijeme met
```


Změna základu pro odkazy .{data-version:v3.2.7}
===============================================

Ve výchozím stavu se relativní odkazy odvíjejí od aktuálního presenteru. To lze změnit pomocí `{linkBase}`:

```latte
{linkBase Admin:Dashboard}
<a n:href="Product:show">detail produktu</a>
```

Odkaz povede na `Admin:Dashboard:Product:show`. Ovlivněny jsou pouze relativní odkazy - absolutní odkazy začínající dvojtečkou a odkazy na aktuální presenter (`this`, `show`) zůstávají nezměněny.

`{linkBase}` platí pro celou šablonu a je užitečné zejména v šablonách layoutu, kde zajistí konzistentní odkazy nezávisle na volajícím presenteru.


Odkazy na signál
================

Expand Down
2 changes: 2 additions & 0 deletions application/cs/how-it-works.texy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Adresářová struktura vypadá nějak takto:
│ │ ├── <b>HomePresenter.php</b> ← třída presenteru Home
│ │ └── <b>default.latte</b> ← šablona akce default
│ └── <b>Bootstrap.php</b> ← zaváděcí třída Bootstrap
├── <b>assets/</b> ← zdroje (SCSS, TypeScript, zdrojové obrázky)
├── <b>bin/</b> ← skripty spouštěné z příkazové řádky
├── <b>config/</b> ← konfigurační soubory
│ ├── <b>common.neon</b>
Expand All @@ -40,6 +41,7 @@ Adresářová struktura vypadá nějak takto:
│ ├── ...
│ └── <b>autoload.php</b> ← autoloading všech nainstalovaných balíčků
├── <b>www/</b> ← veřejný adresář neboli document-root projektu
│ ├── <b>assets/</b> ← zkompilované statické soubory (CSS, JS, obrázky, …)
│ ├── <b>.htaccess</b> ← pravidla mod_rewrite
│ └── <b>index.php</b> ← prvotní soubor, kterým se aplikace spouští
└── <b>.htaccess</b> ← zakazuje přístup do všech adresářů krom www
Expand Down
2 changes: 2 additions & 0 deletions application/cs/presenters.texy
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ Kdykoliv během životního cyklu můžeme některou z následujících metod od
- `sendResponse($response)` presenter ukončí a odešle [vlastní odpověď |#Odpovědi]
- `terminate()` presenter ukončí bez odpovědi

Každá z těchto metod okamžitě ukončí činnost presenteru vyhozením tzv. tiché ukončovací výjimky `Nette\Application\AbortException`.

Pokud žádnou z těchto metod nezavoláte, presenter automaticky přistoupí k vykreslí šablony. Proč? Protože v 99 % případů chceme vykreslit šablonu, tudíž presenter tohle chování bere jako výchozí a chce nám ulehčit práci.


Expand Down
2 changes: 2 additions & 0 deletions application/de/how-it-works.texy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Die Verzeichnisstruktur sieht ungefähr so aus:
│ │ ├── <b>HomePresenter.php</b> ← Klasse des Home-Presenters
│ │ └── <b>default.latte</b> ← Template der default-Aktion
│ └── <b>Bootstrap.php</b> ← Startklasse Bootstrap
├── <b>assets/</b> ← Ressourcen (SCSS, TypeScript, Quellbilder)
├── <b>bin/</b> ← Skripte, die von der Kommandozeile ausgeführt werden
├── <b>config/</b> ← Konfigurationsdateien
│ ├── <b>common.neon</b>
Expand All @@ -40,6 +41,7 @@ Die Verzeichnisstruktur sieht ungefähr so aus:
│ ├── ...
│ └── <b>autoload.php</b> ← Autoloading aller installierten Pakete
├── <b>www/</b> ← öffentliches Verzeichnis oder Document-Root des Projekts
│ ├── <b>assets/</b> ← kompilierte statische Dateien (CSS, JS, Bilder, ...)
│ ├── <b>.htaccess</b> ← mod_rewrite-Regeln
│ └── <b>index.php</b> ← initiale Datei, mit der die Anwendung gestartet wird
└── <b>.htaccess</b> ← verbietet den Zugriff auf alle Verzeichnisse außer www
Expand Down
2 changes: 2 additions & 0 deletions application/el/how-it-works.texy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
│ │ ├── <b>HomePresenter.php</b> ← κλάση του presenter Home
│ │ └── <b>default.latte</b> ← πρότυπο της ενέργειας default
│ └── <b>Bootstrap.php</b> ← κλάση εκκίνησης Bootstrap
├── <b>assets/</b> ← πόροι (SCSS, TypeScript, εικόνες πηγής)
├── <b>bin/</b> ← σενάρια που εκτελούνται από τη γραμμή εντολών
├── <b>config/</b> ← αρχεία διαμόρφωσης
│ ├── <b>common.neon</b>
Expand All @@ -40,6 +41,7 @@
│ ├── ...
│ └── <b>autoload.php</b> ← αυτόματη φόρτωση όλων των εγκατεστημένων πακέτων
├── <b>www/</b> ← δημόσιος κατάλογος ή document-root του έργου
│ ├── <b>assets/</b> ← μεταγλωττισμένα στατικά αρχεία (CSS, JS, εικόνες, ...)
│ ├── <b>.htaccess</b> ← κανόνες mod_rewrite
│ └── <b>index.php</b> ← αρχικό αρχείο με το οποίο εκκινεί η εφαρμογή
└── <b>.htaccess</b> ← απαγορεύει την πρόσβαση σε όλους τους καταλόγους εκτός του www
Expand Down
6 changes: 6 additions & 0 deletions application/en/ajax.texy
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,9 @@ public function handleFoo(int $bar): void
{
}
```


Further Reading
===============

- [Dynamic Snippets |best-practices:dynamic-snippets]
17 changes: 17 additions & 0 deletions application/en/creating-links.texy
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ Links generated using `link()` or `n:href` are always absolute paths (i.e., they

To generate an absolute URL, add two slashes at the beginning (e.g., `n:href="//Home:"`). Alternatively, you can switch the presenter to generate only absolute links by setting `$this->absoluteUrls = true`.

The `|absoluteUrl` filter can also be used in the template to convert a relative path to an absolute path.


Link to Current Page
====================
Expand Down Expand Up @@ -179,6 +181,21 @@ To determine if we are in a specific module or its submodule, use the `isModuleC
```


Changing Link Base .{data-version:v3.2.7}
=========================================

By default, relative links are derived from the current presenter. This can be changed using `{linkBase}`:

```latte
{linkBase Admin:Dashboard}
<a n:href="Product:show">product detail</a>
```

The link will lead to `Admin:Dashboard:Product:show`. Only relative links are affected - absolute links starting with a colon and links to the current presenter (`this`, `show`) remain unchanged.

`{linkBase}` applies to the entire template and is especially useful in layout templates, where it ensures consistent links regardless of the calling presenter.


Links to Signal
===============

Expand Down
2 changes: 2 additions & 0 deletions application/en/how-it-works.texy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The directory structure looks something like this:
│ │ ├── <b>HomePresenter.php</b> ← Home presenter class
│ │ └── <b>default.latte</b> ← template for default action
│ └── <b>Bootstrap.php</b> ← booting class Bootstrap
├── <b>assets/</b> ← resources (SCSS, TypeScript, source images)
├── <b>bin/</b> ← scripts executed from the command line
├── <b>config/</b> ← configuration files
│ ├── <b>common.neon</b>
Expand All @@ -40,6 +41,7 @@ The directory structure looks something like this:
│ ├── ...
│ └── <b>autoload.php</b> ← autoloading of all installed packages
├── <b>www/</b> ← public directory, document root of the project
│ ├── <b>assets/</b> ← compiled static files (CSS, JS, images, ...)
│ ├── <b>.htaccess</b> ← mod_rewrite rules
│ └── <b>index.php</b> ← initial file that launches the application
└── <b>.htaccess</b> ← prohibits access to all directories except www
Expand Down
2 changes: 2 additions & 0 deletions application/en/presenters.texy
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ At any point during the life cycle, we can use one of the following methods to s
- `sendResponse($response)` terminates the presenter and sends a [custom response |#Responses]
- `terminate()` terminates the presenter without a response

Each of these methods immediately terminates the presenter by throwing a silent termination exception `Nette\Application\AbortException`.

If you don't call any of these methods, the presenter automatically proceeds to render the template. Why? Because in 99% of cases, we want to render a template, so the presenter adopts this behavior as the default to simplify our work.


Expand Down
2 changes: 2 additions & 0 deletions application/es/how-it-works.texy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ La estructura de directorios tiene este aspecto:
│ │ ├── <b>HomePresenter.php</b> ← clase del presenter Home
│ │ └── <b>default.latte</b> ← plantilla de la acción default
│ └── <b>Bootstrap.php</b> ← clase de arranque Bootstrap
├── <b>assets/</b> ← recursos (SCSS, TypeScript, imágenes de origen).
├── <b>bin/</b> ← scripts ejecutados desde la línea de comandos
├── <b>config/</b> ← archivos de configuración
│ ├── <b>common.neon</b>
Expand All @@ -40,6 +41,7 @@ La estructura de directorios tiene este aspecto:
│ ├── ...
│ └── <b>autoload.php</b> ← autoloading de todos los paquetes instalados
├── <b>www/</b> ← directorio público o document-root del proyecto
│ ├── <b>assets/</b> ← archivos estáticos compilados (CSS, JS, imágenes, ...)
│ ├── <b>.htaccess</b> ← reglas mod_rewrite
│ └── <b>index.php</b> ← archivo inicial con el que se inicia la aplicación
└── <b>.htaccess</b> ← prohíbe el acceso a todos los directorios excepto www
Expand Down
2 changes: 2 additions & 0 deletions application/fr/how-it-works.texy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ La structure des répertoires ressemble à quelque chose comme ceci :
│ │ ├── <b>HomePresenter.php</b> ← classe du presenter Home
│ │ └── <b>default.latte</b> ← template de l'action default
│ └── <b>Bootstrap.php</b> ← classe de démarrage Bootstrap
├── <b>assets/</b> ← ressources (SCSS, TypeScript, images sources)
├── <b>bin/</b> ← scripts exécutés depuis la ligne de commande
├── <b>config/</b> ← fichiers de configuration
│ ├── <b>common.neon</b>
Expand All @@ -40,6 +41,7 @@ La structure des répertoires ressemble à quelque chose comme ceci :
│ ├── ...
│ └── <b>autoload.php</b> ← autoloading de tous les paquets installés
├── <b>www/</b> ← répertoire public ou document-root du projet
│ ├── <b>assets/</b> ← fichiers statiques compilés (CSS, JS, images, ...)
│ ├── <b>.htaccess</b> ← règles mod_rewrite
│ └── <b>index.php</b> ← fichier initial par lequel l'application est lancée
└── <b>.htaccess</b> ← interdit l'accès à tous les répertoires sauf www
Expand Down
2 changes: 2 additions & 0 deletions application/hu/how-it-works.texy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ A könyvtárstruktúra valahogy így néz ki:
│ │ ├── <b>HomePresenter.php</b> ← Home presenter osztálya
│ │ └── <b>default.latte</b> ← default akció sablonja
│ └── <b>Bootstrap.php</b> ← Bootstrap indító osztály
├─ <b>assets/</b> ← erőforrások (SCSS, TypeScript, forrásképek)
├── <b>bin/</b> ← parancssorból futtatott szkriptek
├── <b>config/</b> ← konfigurációs fájlok
│ ├── <b>common.neon</b>
Expand All @@ -40,6 +41,7 @@ A könyvtárstruktúra valahogy így néz ki:
│ ├── ...
│ └── <b>autoload.php</b> ← az összes telepített csomag autoloadingja
├── <b>www/</b> ← nyilvános könyvtár vagy a projekt document-rootja
│ ├──<b>assets/</b> ← összeállított statikus fájlok (CSS, JS, képek, ...)
│ ├── <b>.htaccess</b> ← mod_rewrite szabályok
│ └── <b>index.php</b> ← elsődleges fájl, amellyel az alkalmazás elindul
└── <b>.htaccess</b> ← tiltja a hozzáférést minden könyvtárhoz a www kivételével
Expand Down
2 changes: 2 additions & 0 deletions application/it/how-it-works.texy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ La struttura delle directory assomiglia a qualcosa del genere:
│ │ ├── <b>HomePresenter.php</b> ← classe del presenter Home
│ │ └── <b>default.latte</b> ← template dell'azione default
│ └── <b>Bootstrap.php</b> ← classe di avvio Bootstrap
├── <b>assets/</b> ← risorse (SCSS, TypeScript, immagini sorgente)
├── <b>bin/</b> ← script eseguiti dalla riga di comando
├── <b>config/</b> ← file di configurazione
│ ├── <b>common.neon</b>
Expand All @@ -40,6 +41,7 @@ La struttura delle directory assomiglia a qualcosa del genere:
│ ├── ...
│ └── <b>autoload.php</b> ← autoloading di tutti i pacchetti installati
├── <b>www/</b> ← directory pubblica o document-root del progetto
│ ├── <b>assets/</b> ← file statici compilati (CSS, JS, immagini, ...)
│ ├── <b>.htaccess</b> ← regole mod_rewrite
│ └── <b>index.php</b> ← file iniziale con cui si avvia l'applicazione
└── <b>.htaccess</b> ← vieta l'accesso a tutte le directory tranne www
Expand Down
2 changes: 2 additions & 0 deletions application/ja/how-it-works.texy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
│ │ ├── <b>HomePresenter.php</b> ← Home Presenterクラス
│ │ └── <b>default.latte</b> ← defaultアクションのテンプレート
│ └── <b>Bootstrap.php</b> ← ブートストラップクラス Bootstrap
├── <b>assets/</b> ←リソース(SCSS、TypeScript、ソース画像)
├── <b>bin/</b> ← コマンドラインから実行されるスクリプト
├── <b>config/</b> ← 設定ファイル
│ ├── <b>common.neon</b>
Expand All @@ -40,6 +41,7 @@
│ ├── ...
│ └── <b>autoload.php</b> ← インストールされたすべてのパッケージのオートローディング
├── <b>www/</b> ← 公開ディレクトリまたはプロジェクトのドキュメントルート
│ ├── <b>assets/</b> ←コンパイルされた静的ファイル(CSS、JS、画像、...)
│ ├── <b>.htaccess</b> ← mod_rewriteルール
│ └── <b>index.php</b> ← アプリケーションが起動する最初のファイル
└── <b>.htaccess</b> ← www以外のすべてのディレクトリへのアクセスを禁止
Expand Down
2 changes: 2 additions & 0 deletions application/pl/how-it-works.texy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Struktura katalogów wygląda mniej więcej tak:
│ │ ├── <b>HomePresenter.php</b> ← klasa presentera Home
│ │ └── <b>default.latte</b> ← szablon akcji default
│ └── <b>Bootstrap.php</b> ← klasa startowa Bootstrap
├── <b>assets/</b> ← zasoby (SCSS, TypeScript, obrazy źródłowe)
├── <b>bin/</b> ← skrypty uruchamiane z wiersza poleceń
├── <b>config/</b> ← pliki konfiguracyjne
│ ├── <b>common.neon</b>
Expand All @@ -40,6 +41,7 @@ Struktura katalogów wygląda mniej więcej tak:
│ ├── ...
│ └── <b>autoload.php</b> ← autoloading wszystkich zainstalowanych pakietów
├── <b>www/</b> ← katalog publiczny czyli document-root projektu
│ ├── <b>assets/</b> ← skompilowane pliki statyczne (CSS, JS, obrazy, ...)
│ ├── <b>.htaccess</b> ← reguły mod_rewrite
│ └── <b>index.php</b> ← pierwszy plik, którym uruchamia się aplikacja
└── <b>.htaccess</b> ← zabrania dostępu do wszystkich katalogów oprócz www
Expand Down
2 changes: 2 additions & 0 deletions application/pt/how-it-works.texy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ A estrutura de diretórios se parece com algo assim:
│ │ ├── <b>HomePresenter.php</b> ← classe do presenter Home
│ │ └── <b>default.latte</b> ← template da ação default
│ └── <b>Bootstrap.php</b> ← classe de inicialização Bootstrap
├── <b>assets/</b> ← recursos (SCSS, TypeScript, imagens de origem)
├── <b>bin/</b> ← scripts executados a partir da linha de comando
├── <b>config/</b> ← arquivos de configuração
│ ├── <b>common.neon</b>
Expand All @@ -40,6 +41,7 @@ A estrutura de diretórios se parece com algo assim:
│ ├── ...
│ └── <b>autoload.php</b> ← autoloading de todos os pacotes instalados
├── <b>www/</b> ← diretório público ou document-root do projeto
│ ├── <b>assets/</b> ← arquivos estáticos compilados (CSS, JS, imagens, ...)
│ ├── <b>.htaccess</b> ← regras mod_rewrite
│ └── <b>index.php</b> ← arquivo inicial pelo qual a aplicação é iniciada
└── <b>.htaccess</b> ← proíbe o acesso a todos os diretórios exceto www
Expand Down
Loading