Comments (4)
A few hints here:
1. The uri and link view helper in TypoScript Rendering work exactly the same as Extbase's according view helpers
In fact you should use them like so <t:uri.action ... />
, the old names <t:uri.ajaxAction ... />
are deprecated and only work for backwards compatibility.
I suggest you catch up with understanding why and when you need to specify pluginName
and extensionName
for these view helpers Extbase ships. The same rules apply for the view helpers this extension ships
The only difference is, that the TypoScript Rendering view helpers adds an additional argument to the URI &tx_typoscriptrendering[context]=...
With this argument being in the URL, TypoScript Rendering will only return the response of the specified plugin, not the whole HTML document.
2. Verify, whether you put the correct namespace import into your Template:
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:t="http://typo3.org/ns/Helhum/TyposcriptRendering/ViewHelpers"
data-namespace-typo3-fluid="true">
...
3. Put the resulting URI from the view helper in the browser and verify whether you get the response from the plugin, as you expect.
Last but not least: Creating an issue here is fine. You also provided some code snippets, which is good as well. In addition you should add a more complete context to the snippets, like the full HTML, so that for another person it is possible to recreate the exact issue you are seeing. A complete example repo with all code would be perfect. Otherwise it is impossible to know what is going wrong for you and thus not possible to really help any further.
I double checked with helhum/typoscript-rendering 2.4.1 in a new project with TYPO3 11.5.22 and everything works in my test cases like expected.
Therefore I'll close this issue here. Feel free to come up with more information (like a complete example to reproduce) and add it here. I will see and answer as time allows
from typoscript_rendering.
Thanks for your response. I didn't give you all the code as I don't know where it is caused. So I'd have to priovide the whole code. Maybe I can make a minimalistic extension. I hoped that it will be clear where the problem is or if it's a known problem...
The namespace is correct. Otherwise I wouldn't get the error from your extension.
I have an essential question:
Can the ajax URL only be generated in a plugin itself? I'm generating it from a normal template (outside of a plugin) or from the page layout. I saw your ajax_exmaple where it seems to be generated in a plugin.
from typoscript_rendering.
Can the ajax URL only be generated in a plugin itself?
Let me cite from my response above:
The uri and link view helper in TypoScript Rendering work exactly the same as Extbase's according view helpers
It could work somehow, but it would be more robust to generate all links to a plugin from within this plugin's template.
from typoscript_rendering.
I turns out that it works if I put the plugin (e.g. 'Unread' in my case) on the page where the URL is generated. Maybe this is how it is meant to be in your extension (?) but it's not what I wanted to do. I wanted to call the Extbase action without having the plugin on the page. I thought this is why others use a custom page type.
It also turned out that extension MdUnreadnews can already do that (so I wasted lots of time). And they're also using a custom page type. I'm really suprised, how simple it is:
# setup.typoscript
/**
* used for ajax call to remove unread information
*
*/
PAGE_REMOVE_UNREAD_NEWS = PAGE
PAGE_REMOVE_UNREAD_NEWS {
typeNum = 120719
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:application/html
xhtml_cleaning = 0
debug = 0
admPanel = 0
}
10 = USER_INT
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = MdUnreadnews
pluginName = Unread
vendorName = Mediadreams
switchableControllerActions {
Unreadnews {
1 = removeUnread
}
}
settings {
useStdWrap := addToList(newsUid)
newsUid = TEXT
newsUid.data = GP:newsUid
}
}
}
So I can send my ajax request to /index.php?type=120719&newsUid=...
This indeed works everywhere. No need to put a plugin anywhere.
Disadvantage is the page typeNum. I found your extension, because I wanted to get rid of that.
from typoscript_rendering.
Related Issues (20)
- PHP 7.2 compatibility HOT 6
- Typo3 v9 compatibility HOT 5
- additionalParams doesn't work in AjaxActionViewhelper HOT 2
- "Real" json response HOT 4
- Content Type in Cached Output HOT 8
- Ajax Pagination in News doesnt work HOT 6
- Additional query params HOT 4
- Is pageNotFoundOnCHashError requirement really .. required? HOT 10
- How to change the URL without reloading a page? HOT 1
- Question: version 2.1.0 and php 7.3 HOT 1
- AJAX-based pagination in the 'ext:news' works not respecting category and tag HOT 5
- uri.action and valid JSON - no "Cached page generated"
- ...\Widget\LinkViewHelper::render not compatible with ...\AbstractTagBasedViewHelper::render()
- version 2.2.0 should actually be version 3.0.0 HOT 4
- TYPO3 Security Update 10.4.14 breaks typoscript_rendering partially HOT 4
- Uri/CObjectViewHelper still uses TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper HOT 1
- TYPO3 v11 compatibility HOT 3
- PHP8 error with content-type reading HOT 2
- TYPO3 v12 compatibility HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typoscript_rendering.