Giter Club home page Giter Club logo

Comments (4)

helhum avatar helhum commented on August 20, 2024

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.

fishbone1 avatar fishbone1 commented on August 20, 2024

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.

helhum avatar helhum commented on August 20, 2024

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.

fishbone1 avatar fishbone1 commented on August 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.