Error while creating links across modules

Notice: This thread is very old.
unagi2020
Member | 18
+
0
-

Hello,
I have following directory structure

  • \ModuleOne\templates\default.latte
  • \ModuleOne\presenters\OnePresenter.php
  • \ModuleTwo\templates\default.latte
  • \ModuleTwo\presenters\TwoPresenter.php

I want to call Two:Two:default template from One:One:default template. Somehow when I use {plink Two:Two:default} shortcut, I get following error…

error: Cannot load presenter ‘One:Two:Two’, class ‘OneModule\TwoModule\TwoPresenter’ was not found in ‘../app/OneModule/TwoModule/presenters/TwoPresenter.php’.

What am i doing wrong ? Why is framework trying to find TwoPresenter in /OneModule/TwoModule/presenters directory instead of /TwoModule/presenters

Please Help !!!!
Unagi

duke
Member | 650
+
0
-

Use: {plink :Two:Two:default} or just {plink :Two:Two:} as ‘default’ action is the default.
The : (colon) symbols have similar meaning as / symbols in file paths. If the link identifier starts with a colon, it's considered absolute, otherwise it's considered relative to the current presenter. This allows you to use stuff like {plink fooAction} or {plink barSignal!} to link to action/signal of the current presenter.
Btw, you can use shorter {link} from presenter templates. The {plink} is meant to be used from subcomponents of the presenter where it bypasses the subcomponents linking. {link} works on current component which in the case of presenter template is the presenter itself.

unagi2020
Member | 18
+
0
-

Thank you duke. Appreciate quick response.

Jan Tvrdík
Nette guru | 2595
+
0
-

Additional information can be found in Modules-Usage example.