How to generate sef url in joomla3.1 component - url-routing

How to generate sef url in joomla3.1 component?
My route is here.
my_component/view/categories/category/catID/itemID

To do this, you would use something like the following:
echo JRoute::_('index.php?option=com_mycomponent&view=categories&catid=20&Itemid=50');
Joomla will automatically turn this into a SEF URL using the JRoute() class.
For more information on supporting SEF URL's with your component, have a read of this:
http://docs.joomla.org/Supporting_SEF_URLs_in_your_component
Hope this helps

Related

How can i add subdomain based views

Hello Everyone!
Currently i'm working on a proyect where every customer can add it's store to add some services and stuff. Even when the view it's the same for all stores (obviously loading each store own data) i would like to create an url using as subdomain the store name like this.
Let's say the store name is : The Wolf
So the URL i would like it to have is : thewolf.mycustomdomain.com
I'm currently working on React js using react-router-dom so i would like to ask to this community if anyone knows how to make this happen.
Thanks in advance if anyone can give me some hints!
You can not create subdomains in react. You need to configure a proxy for it. You can look at this post for more information.

Slug that isn't whole file name in Next.js?

I'm attempting to create a route in Next.js that follows a format like:
localhost:3000/post-SLUG
By creating a file with the name:
/pages/post-[slug].js
When I navigate to an example like localhost:3000/post-example I get a 404. Is it possible to do this type of routing? I realize that this is probably not the best URL setup, but I'm trying to match URLs from an already deployed site as a part of a migration to Next.
It's not possible to do it with Next.js routing system because in order to be dynamic the part of URL must match this regular expression:
/\/\[[^/]+?\](?=\/|$)/
So the route have to be /post/[slug]/.
The /pages/post-[slug].js would be accessible as a static route http://localhost:3000/post-[slug].
You can utilize a Custom Server to create this kind of routes.

how to redirect to home page from Servlet to JSP with Angular UI

I have an AngularJs UI login page and I'm posting the username and password details to a Servlet to validate, and when I'm returning back I'm using sendRedirect from Servlet but it's not working. Here is my sample code
In Servlet:
req.sendRedirect("NewFile.jsp");
It is displaying content inside NewFile.jsp within the login page itself instead of redirecting to NewFile.jsp
I have tried using "$window.location.href" inside AngularJs code but that itself didnt forward to home page.
Any help is much appreciated.
Thank you!
Acording of what you said in the comment of the bounty, I have to say that having everything in only one controller sounds like a bad idea, for more information about this and naming conventions go to Naming conventions and best practices
According to your question, maybe you need to give more details of the problem, it's not clear.
Have you tried to use $location module?
https://docs.angularjs.org/api/ng/service/$location
You can use de .path() module to redirect.
$location.path('#!/');
That will redirect you to the home page.

How do you create multiple pages when using Reactjs? Is there a specific function to carry this out?

What function do I have to use to create multiple pages on React. Is there a type of link or something thank can direct me to pages in my web application.
React is meant to be used in single page application, so by default it do not provide such functionality. But if you want to add routing in it then you can use react-router.
What react-router will do is just swap you browser link to look like it is on a new page and replace content in body.
Hope this will make you help to understand the use of react.

How to find current controller or action in routes.php in cakephp

I try lots of methods to find current controller and action in cakephp routing, but I didn't got answer. Is there any method to find controller and action in routing. If yes, please help me. Or if there is any other way to find these, Please tell me.
It's the routes that decide to what controller and action a url maps to. When routes.php is being loaded the routing process has still not been done (since you are still setting up routes), so you cannot know controller or action is in routes.php.
If the website formatted something like this :
www.johndoe.test/test/test_action/
then probably it can be found on test controller but of course that depends on the settings of the website on how the developer configured it. It may also be found on routes.php like #ADmad said.

Resources