Typo3 v9 how to query my extension with specific url? - typo3

im in the process of developing a Typo3 extension and i want to access the data of this extension from a static URL.
The extension will be used in multiple systems and i want to query them like so: https://example.com/myextension
the specific URL slug is not relevant. The goal is that i dont have to configure in every of the systems the specific url where i
can reach the data gathered by my extension to summarize them all in a dashboard overview.
So my question is how can i set that my extension controller action is triggered with the call of a specific url?
If there are better ways to do this, please let me know
Many thanks!

You can add a Middleware https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/RequestHandling/Index.html that calls your action for a specific URL.
Or you could add a real page with a given slug and your plugin with an Upgrade Wizard https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/UpdateWizards/Creation.html or Extension update script https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/UpdateWizards/ExtUpdateFile.html.
For the nice URL you would use a routeEnhancer in the Site Config.
If this is something like a webservice where you need control over the HTTP verbs or implement OAuth, I would go with 1.
For something like a landing page I would go with 2. Also to expose an Extbase plugin action.

Related

How do I rewrite URL to drop file extension for pdf on github pages?

Imagine my website is hosted on GitHub Pages and has a custom domain website.com. I can access a pdf at website.com/mypdf.pdf
Is there a way where I can make it work at website.com/mypdf?
As mentioned in comments, if you are using static website hosted by a 3rd party like GitHub pages, you don't really get a lot of control over http server. I would tentatively say you cannot control URL rewrite rules on GitHub.
What you could potentially do instead is to host a page with a bit of JavaScript that would start the download on a given event (button click, page load, etc) this way you could mask your actual download URL with this html page (that by convention comes with no file extension)
UPD: and surely enough someone's been doing it already: http://lea.verou.me/2016/11/url-rewriting-with-github-pages/. The post is going on about having nice urls, but I believe file downloads implementation can be implemented similarly
Yes you should make your website with MVC structure. Make a controller and in Index action load pdf file.
Then on action calling your pdf will be loaded like that:
Students/AllResult etc

How to hook TYPO3 Form submit

I need to hook into a TYPO3 form submit event. Do I need to write a TYPO3 Extension to achieve this?
I installed TYPO3 version 7.6.23. During the install process I picked the default 'distribution' and I now have the "TYPO3 CMS bootstrap package". When I go to the Installed Extensions screen I have the Form Extension installed (key=form).
I have a page with a form on it and I need to hook into that form submit event and do a HTTP POST to another site with some of the form data. Optionally I would like to prevent the form submit from happening, depending on the return value of my POST to the other site - so perhaps what I need in-fact is a 'before submit' event to hook.
Do I need to write an extension to achieve this? If so how can I get started? There are extension tutorials on typo3.org but they imply I need to build a full blown MVC extension, which seems way over the top for my requirements.
Due to the lack of hooks in the 7.6 form extension you have two options:
Generate a JavaScript file which listens to the submit event, prevent it and run an AJAX call to submit the data to your external site. Depending on the response you can either do a manual submit or displaying an error message.
Upgrade to TYPO3 8LTS with the new form. There you have more possibilities to hook in and do your HTTP request.

Is it possible to create a canonical URL for pages with just a pageid in confluence?

I need to groups each space in the Piwik web analytics software. The cleanest way to do it would be if all URL´s had the spacekey in it, to allow each space-owner to easily get a complete view of their space and retain all functionality like browsing the site with an analytics overlay.
Some URL´s are canonical, however some just have an URL like /pages/viewpage.action?pageId=199921170
Is there some way through the AJS API or other method to find force a working URL in the form: /display/spacekey/title-of-page
The most important part is to have the spacekey in the URL. If there´s no workaround I might just generate an invalid URL by inserting spacekey and let each space-owner fix their page-titles if they want working analytics :-)
We are running Confluence version 5.10.7
(There´s an unresolved open issue on https://jira.atlassian.com/browse/CONF-11285 concerning the broader issue of sometimes having ugly URLs in confluence)
Instead of adding an incorrect URL, you could use a custom variable to record the space key, e.g.
_paq.push(['setCustomVariable','1','Space Key', AJS.params.spaceKey]);

Is it possible to create a MVC application that navigates like Facebook?

Facebook seems to have a single page where the content changes based on user interaction.
For example: If I click on somebody's post, the url changes to the user's profile/posts/.
Now I'm sure this is possible to implement on MVC.
Can somebody help me get started?
Perhaps some reference/sameple/tutorial (I believe this will heavily involve configuring the routings).
Sure, that's called Custom Routing. You can set up custom routing in the routeconfig.cs file in your project (for pre-MVC4, routing is in Gloabal.asax). Then you just use an Actionlink Helper to build your links.
Read More: http://www.codeproject.com/Articles/641783/Customizing-Routes-in-ASP-NET-MVC

How to intercept error request and redirect to a custom page?

Here is one of the use-case as to what I want to do:
A User clicks on a blog-link or directly pastes the blog-link in the URL
The blog portlet is on the private-page of a Community (Site).
Since the user is not a member of the Community (Site) he would be taken to the error page.
He is shown, either a 404 page or a No-access error page.
My requirement starts: Now instead of showing the above pages or a customized version of the above pages.
I want to Intercept the request for 404 or other such requests.
And redirect to a portal page (not a static error page) based on some parameters of the User and the initial request parameters.
In this case I would want the user to be redirect to any public page of the same Community (Site) and ask him to Join or request membership for that Community (Site).
So in short I would want a way to intercept the request which generates the error and then redirect to where ever I want.
Is this available in liferay? If not can I get some idea as to how can I achieve this?
Environment: Liferay 6.1 GA2
Thanks for your valuable time.
Add a JSP page to manage 404 errors as described here in that Liferay's forum post.
In that JSP you can put your custom logic based on whatever param (the user, the community, etc..) that you can access from inside the JSP using, for example, the themeDisplay object.
An alternative way (and the way I have redirect 404 errors to a specific page in the community) is to override the 404.jsp with a Hook. Then add your custom logic to the overridden JSP.
I'm assuming something similar could be done for no-access.