1
votes

I want to use an action from a Controller as an Ajax Request with pageType, but I want also use the same action on pages as content elements. Why i should create two actions?

But now I don't know how I can use an <f:link.action> with the actual pageType? I can set the Option pageType <f:link.action pageType="12345"> manually. But this should do automaticly like

<f:link.action pageType="{pageType}">

Do you have an idea, how i can do this?

Thank you

2

2 Answers

1
votes

There is no solution for this problem.

0
votes

Rhetoric question: Automatically basing on... what ?

Standard page num in TYPO3 is 0 and it's also by default used in all linking ViewHelpers, if you want to use something else you need to write it exactly in the view (pageType="12345") or, for an instance configure it in your setup.txt file in your extension:

plugin.tx_yourextension.settings.ajaxPageType = 12345

So you can use it in your view like:

<f:link.action pageType="{settings.ajaxPageType}">

Disadvantage of this approach is that you need to repeat this pageNum in settings and also in plugin's bootstrap, anyway that's better then checking everytime which number exactly is this.

TIP: Don't forget to flush system cache to take setup.txt changes into account.

P.S.

Of course I assume that you're bootstrapping your ajax actions like ie:

yourAjaxAction = PAGE
yourAjaxAction {

  typeNum = 12345
  10 = USER
  10 {
    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
    extensionName = YourExtension
    pluginName = YourFePluginRegisteredProperly
    vendorName = VENDOR_NAME
  }

  config {
    disableAllHeaderCode = 1
    xhtml_cleaning = 0
    admPanel = 0
    debug = 0
    no_cache = 1
  }
}

If you do - you don't need to use f:link.action VH, if you don't... you should start :)