How to short the url controller in Magento - magento

I have created a controller named «wizard» that should get a parameter and then, depending on this parameter, do this thing or another thing.
I can do this easily with the url http://mysite.com/wizard/index/index/action/cutting. That should give the action parameter with the value «cutting» to my indexAction of my IndexController.
But what I'd really want is to have the same thing but with the url:
http://mysite.com/wizard/cutting
Where «cutting» is the parameter. If I want to handle this with my indexAction of my IndexController.php, what should I change on the config.xml? (well, I'm supposing that I can set this on the config.xml file, but don't know how).
Btw: I know I can pass something like ?action=cutting, but that's not what I want...
Thanks!

You have to enable mod_rewrite on your server (if you are using apache) and enable "Use web server rewrites"
Here's a good tutorial explaining the issues.

Related

Click change Url laravel

How to debug
when I click this
<li>Promotion</li>
It'll go to en/promotion page
but after I do somthing not sure what I do It change to /promotion
any idea how to debug this
You can use Laravel's URL Default Values for this. It allows you set a default value like the 'en' so you don't have to write it everytime and you would be able to use url('test2') to get en/test2
I'm guessing you want to be able to have different languages in your website, but don't want to manage this manually on every redirect. You either need to write your own middleware to do this or use a package.
I would recommend the latter. In my projects I'm using this one, there are others out there, you can find one that suits your needs.
This package has the ability to do exactly what you want - it rewrites your URL to include the language parameter.

Joomla - using ajax in custom module

Requirments: I can't use components and ajax interface (joomla com).
My goal: Send POST data from default.php (mod_x) to helper.php (mod_x). Data is checked checkboxes - using ajax.
How to do this?
I know there has to be a method, to do this directly (can someone give me an example), by removing (I know its security risk, but there has to be a way to secure it by hacking joomla)
defined('_JEXEC') or die('Restricted access');
Is there some way to give a module task - just like you can do using component (controller)? I can't use component myself. How would this be done? Please be explicit.
Is there any other possible way? There has to be... I'm ready for some serious brain-storm. Let's get creative, guys.
P.S. To sum it up, I try to find some creative way to not use components, just module to do ajax call from default.php (ajax runs on checked checkbox/s)
I would prefer also an example in code. Thank you!
Fron Joomla 3.2 if you needed to make an AJAX request in Joomla! from a custom module or plugin, you can build the URL as below.
index.php?option=com_ajax&module=your_module_name&method=YourMethodName&format=json
Explanation of each parameter
1. index.php?option=com_ajax : ALL requests must be routed through com_ajax.
2. module=your_module_name: The first part of this is the type of extension you're using. This can either be 'module' or 'plugin'. The second part is the name of the extension. please take care you're not including the prefix 'mod_' or 'plg_', just the name.
3. method=YourMethodName: This is the method name that you are trying to call. If you're using this in a module then the method must be appended with 'Ajax'. So, the method represented here will be YourMethodNameAjax. If you're using this on a plugin, the method must be prepended with 'onAjax'. So, the method represented here will be onAjaxYourMethodName.
Check more at Joomla doc

How to build WOPI validation application

http://wopi.readthedocs.io/en/latest/build_test_ship/validator.html
As per this documentation, we need to build some HTML host page.
In this document, they mention one point that I didn't understand completely
The simplest way to use the validation application is to use the view
action. To use the view action hosts should treat .wopitest files the
same way other Office documents are treated. In other words, hosts
should do the following:
Launch a host page pointed at the .wopitest file. Ideally, this should
be the same host page used to host regular Office Online sessions.
This will allow the validation application to test things like
PostMessage and do some validation on the way the Office Online iframe
was loaded.
What is .wopitest file and what I need to do exactly, Can anyone please guide me ? please explain stepwise
They mean that you have to call that action in the same way you call any other action (looking for the action url in the discovery, etc.).
For example, when you want to open a .docx for view, you look into the discovery.xml and you find that you have to call https://word-view.officeapps-df.live.com/wv/wordviewerframe.aspx?", and of course you must have ready the Rest services for that action (checkFileInfo, etc.) and the WOPISrc pointing to a file that in fact is a .docx . Well, for the validation application is exactly the same, but you should call to WopiTest app instead of Word app (inside the discovery) and your generated WOPISrc should point to a file called "xxxx.wopitest" instead "xxxx.docx". That's it! ;)

Is it possible to extend Yii URL routes and rules through a Controller?

Is it possible to extend Yii URL routes and rules through a Controller on the fly, or by extending the CController class itself?
I am really stuck with this, have not tried anything.
How to do this in/with Yii?
First you should be aware of what URL rules are used for:
Parsing an incoming URL. The urlManager component resolves a URL to a route so that Yii can call the right action in a specific controller and module.
Creating URLs from calls to createUrl() in your code.
Considering (1) above it is obvious, that you can not add URL rules in your controller if you want to use these URLs in your application. It's much too late, as Yii already has gone through the process of resolving a request to a route. Even if you'd only wanted to create URLs it doesn't make much sense as your application will never understand them.
The correct way to bring more dynamics into your URL parsing/creation is to use a custom URL rule class. In there you can write any code you want to create and parse even the most complex URLs. The topic is described in the manual.

How to manage URLs in CodeIgniter so they can be updated in a single place

I believe Smarty templates has functionality built in that allows you to manage your site URLs from a config file so if something gets moved, you only have to update the URL in one place. Does this sort of functionality exist in CodeIgniter? If not, any pointers or examples on how/where to add it?
For example:
Instead of hard-coding the link it would be: Settings
But where would you want to set $links so that it was available everywhere? Or is it really best to just hard code them?
Take a look at the config class. It allows you to make custom config files.
It's not entirely made for URL's but you sure can use them.
The base url should be basically right at the start of /app/config/config.php, where app is the name of your codeigniter application folder. You access it through calls to the base_url() function.
Yes, it's called Routes, configuration located at config/routes.php. Documentation
If you ask about the rendered html of the links, then your best bet would be using site_url() in conjunction with constants, for example site_url(URL_SETTINGS);, there is no built in functionality for that, but I can say I don't think that is necessary as it would be used too rarely, but it would influence performance every single load.

Resources