How to redirect in Plugin.php - pimcore

I need quick tip:
how to redirect to plugn's controller from plugins/MyPlugin/lib/MyPlugin/Plugin.php
?
I know that
header("Location:http://example.com");
probably works, but mayby is sth better?
Thanks in advance!

You could use this:
$redirector = new Zend_Controller_Action_Helper_Redirector();
$redirector->gotoSimpleAndExit('action','controller','default');

Related

Calabash iOS - How to clear text in a webview

clear_text doesn't work for me when testing a webview. Does anyone know of a different method for webview/cordova apps? The locator I'm using is "webView css:'input#username'" but that seems to be fine as enter_text is working.
Any suggestions?
Thanks,
Lewis.
Thanks but set_text("webView css:'input#username'", "") didn't work. I ended up using the solution you mentioned here
Thanks.
set_text("webView css:'input#username'", "")
You might also try using the WebView JavaScript API
When I had a similar problem, I ended up using something like this :
Then /^I clear a field with "([^\"]*)" text$/ do |name|
name = set_value name
element = query("UITextFieldLabel text: '#{name}'")[0]
touch(element)
wait_for_keyboard
name.to_s.split('').each do |c|
keyboard_enter_char 'Delete'
end
end
Details are in here: Clear field with calabash-ios

Greasemonkey script to replace a static segment in changeable URLs of the same website

Many different pages on a single (fictional) website https://www.brightideas.org contain segment '=eng' and I want to replace it, for example, with '=rus' to access its page in the corresponding language.
Example of URL: https://www.brightideas.org/gardening-skills/25/how-to-grow-a-tree?lang=eng
Segment '=eng' is always located at the end of the URLs.
Can anyone help me with a script that will accomplish this task?
Thanks in advance!
I think the easiest way to do this is:
var oldHref = window.location.href;
if(str.endsWith("eng")){
var newHref = oldHref .replace("eng", "rus");
}else{
console.log("Error in Script")
}
greets
Alex

Liferay.Service.register is not a function?

I am trying to call this javascript method:
Liferay.Service.register("Liferay.Service.myservice", "de.package.service", "my-portlet");
But all I get is this error:
Liferay.Service.register is not a function.
(In 'Liferay.Service.register("Liferay.Service.myservice", "de.package.service", "my-portlet")', 'Liferay.Service.register' is undefined)
Honestly ... I have no idea why this is happening.
Could anyone help me out here ?
Yea, here is the answer:
forget about Liferay.register and all that other Liferay. stuff.
Use async json webservices instead.
works like a charm :)

Return err view is not working

I have a controller that has a return type of void. Is there any way which I can redirect this controller to an error view page?
I try many things but its not worked for me like create error page and return it like
return View("Error");
Thanks!
Please try to use the following:
System.Web.HttpContext.Current.Response.Redirect
Good luck!
Shimi

How can I send more information via GET method? in VALENCE

i need help with Valence portal.
I open the app with direct link
here:
http://192.168.1.1:7040?display=desktop&app=1001
but I need more data on this, PE: 'CODUSER' but if I put &coduser=1 doesn't work
http://192.168.1.1:7040?display=desktop&app=1001&coduser=1
I extecute an alert and this is the result to read the URL:
http://192.168.1.1:7040/desktop/examples/P01/index.html?app=1001&key=xxxxxxx&lang=en
URL doesn't contains the "coduser".
How can I send more information via GET method?
Thanks, Ivan.
I found a solution to my problem. Not is the best solution but is an aceptable solution, if any knows other, tell me, please.
My Solution:
I created a new Hook.js. on this file can read a current url (here read all url, 'coduser' included).
on the new Hook:
cod=foundParameterURL('codUser');//personal function, include current URL (location.href)
Ext.util.Cookies.set("coduser",cod);
later on the app, read the Cookie:
var cod = Ext.util.Cookies.get("coduser");
and continue with normality
If any knows as send information Hook.js to app tell me please.
thanks for all, Ivan.

Resources