Joomla Retrieve current route in module - php

This is something I feel should be easy, but after an hour so far scouring the web it just does not seem to be jumping out.
What I want is to have a module trigger a task in a component, then redirect to the last page.
To do this I want to get the current route in the modules form. However I cannot find any Joomla function that can output the current pages "JRoute", if I try use JRoute with no parameters it just outputs the url with no query, so will every method of JURI.
There must be an obvious answer to this, however for some reason I might just not be searching for the right thing and not turning up any results.

Try:
JURI::getInstance()->toString()
This will give you the current url.

Related

Listing php functions that were run to load page

I'm working on a custom website and currently integrating a new section. Having done everything exactly the same as with previous sections, the behavior achieved is different.
It would be useful if I could get a list of functions run once the page loads, just like when you get them listed if there is a critical error, without having any errors.
Can't find any information on this, so any help will be appreciated!
All information that you need are in xhprof.
With that, you can check any function called in given request.

Laravel "This webpage has a redirect loop" only on a single route suddenly

Ok so the thing is I have laravel 4.2 installed and it's working great.
Up to today when I did a couple of small changes and now my website/used path returns this incredibly infuriating message "This webpage has a redirect loop" forever and ever.
I am using localisation and the mcamara plugin installed, up until today all was perfect and I could use my 2 locals en/da without any problems like website/en/used or website/da/used and of course the normal paths website/used etc which would remember lang choice and show content as such.
Now after trying to implement a simple feature: Creating a UsedController to handler form requests for a new view which should make it possible to upload a picture and title and description. It worked for a couple of tries without posting to database, just dd, then suddenly this issue with redirect starts and now 6 hours or so on it keeps going on and on and on and it's making me totally frustrated, I deleted everything I created and now it still won't work at all.
website/en/used and website/da/used still works though, but website/used gets the page from hell every time :(
So my question I guess is:
Why can a controller just "hijack" a route like that, and also just refuse to do it's job?
currently only when accessed website/used I get the loop error, index # used does nothing despite trying to move the view there.
here is my routes.php file:
http://imgur.com/DNqgjwv
here are the routes:
http://i.imgur.com/om33cbQ.png
Still don't get why a controller here being "UsedController" now suddenly hijacks all /used
and according to this routes table, my requests to /used should go through UsedController#index yes? But weirdly this doesn't happen :( it completely ignores everything and all I get atm is this endless loop thing.
After even further testing and editing I even cleared the entire routes file only to have UsedController left like this:
Route::resource('used', 'UsedController');
even that still won't work when I tried that and just tried displaying the view with index function at UsedController.
Investigating it in chrome has the following:
{"type":"Program","data":{},"startTime":13961301.056,"children": [{"type":"ResourceSendRequest","data": {"requestId":"1172.166","url":"westcoastmink.dev:8888/used/","requestMethod":"GET"},"startTime":13961301.449,"frameId":"1172.1"}],"endTime":13961301.546},
{"type":"Program","data":{},"startTime":13961301.957,"children":[],"endTime":13961301.989},
{"type":"Program","data":{},"startTime":13961306.072,"children":[],"endTime":13961306.103},
{"type":"Program","data":{},"startTime":13961306.133,"children":[{"type":"ResourceSendRequest","data":{"requestId":"1172.166","url":"westcoastmink.dev:8888/used","requestMethod":"GET"},"startTime":13961306.339,"frameId":"1172.1"}],"endTime":13961306.402},
{"type":"Program","data":{},"startTime":13961309.474,"children":[],"endTime":13961309.507},
{"type":"Program","data":{},"startTime":13961309.539,"children":[{"type":"ResourceSendRequest","data":{"requestId":"1172.166","url":"westcoastmink.dev:8888/used/","requestMethod":"GET"},"startTime":13961309.776,"frameId":"1172.1"}],"endTime":13961309.908},
{"type":"Program","data":{},"startTime":13961312.76,"children":[],"endTime":13961312.811},
{"type":"Program","data":{},"startTime":13961317.462,"children":[],"endTime":13961317.505},
{"type":"Program","data":{},"startTime":13961317.555,"children":[{"type":"ResourceSendRequest","data":{"requestId":"1172.166","url":"westcoastmink.dev:8888/used","requestMethod":"GET"},"startTime":13961317.899,"frameId":"1172.1"}],"endTime":13961318.027},
{"type":"Program","data":{},"startTime":13961325.426,"children":[],"endTime":13961325.469},
{"type":"Program","data":{},"startTime":13961325.539,"children":[{"type":"ResourceSendRequest","data":{"requestId":"1172.166","url":"westcoastmink.dev:8888/used/","requestMethod":"GET"},"startTime":13961326.142,"frameId":"1172.1"}],"endTime":13961326.299},
{"type":"Program","data":{},"startTime":13961329.605,"children":[],"endTime":13961329.634},
{"type":"Program","data":{},"startTime":13961329.664,"children":[{"type":"ResourceSendRequest","data":{"requestId":"1172.166","url":"westcoastmink.dev:8888/used","requestMethod":"GET"},"startTime":13961329.964,"frameId":"1172.1"}],"endTime":13961330.057},
{"type":"Program","data":{},"startTime":13961333.556,"children":[],"endTime":13961333.585},
{"type":"Program","data":{},"startTime":13961333.619,"children":[{"type":"ResourceSendRequest","data":{"requestId":"1172.166","url":"westcoastmink.dev:8888/used/","requestMethod":"GET"},"startTime":13961334.033,"frameId":"1172.1"}],"endTime":13961334.201},
{"type":"Program","data":{},"startTime":13961341.465,"children":[],"endTime":13961341.521},
{"type":"Program","data":{},"startTime":13961341.586,"children":[{"type":"ResourceSendRequest","data":{"requestId":"1172.166","url":"westcoastmink.dev:8888/used","requestMethod":"GET"},"startTime":13961341.946,"frameId":"1172.1"}],"endTime":13961342.057},
{"type":"Program","data":{},"startTime":13961348.486,"children":[],"endTime":13961348.518},
{"type":"Program","data":{},"startTime":13961348.553,"children":[{"type":"ResourceSendRequest","data":{"requestId":"1172.166","url":"westcoastmink.dev:8888/used/","requestMethod":"GET"},"startTime":13961348.829,"frameId":"1172.1"}],"endTime":13961348.902},
{"type":"Program","data":{},"startTime":13961353.626,"children":[],"endTime":13961353.655},
{"type":"Program","data":{},"startTime":13961353.687,"children":[{"type":"ResourceSendRequest","data":{"requestId":"1172.166","url":"westcoastmink.dev:8888/used","requestMethod":"GET"},"startTime":13961353.908,"frameId":"1172.1"}],"endTime":13961353.985},
{"type":"Program","data":{},"startTime":13961359.02,"children":[],"endTime":13961359.05},
{"type":"Program","data":{},"startTime":13961359.076,"children":[{"type":"ResourceSendRequest","data":{"requestId":"1172.166","url":"westcoastmink.dev:8888/used/","requestMethod":"GET"},"startTime":13961359.292,"frameId":"1172.1"}],"endTime":13961359.356},
{"type":"Program","data":{},"startTime":13961363.636,"children":[],"endTime":13961363.668},
A lot of requests with and without / at the end ? :o
Any help will be greatly appreciated as I have been stuck all day literally... :(
So status is that I still do not know what caused this problem, but I guess it had something to do with the localisation, I solved my issue by using a different controller and routes for the editing part, and leave the translation of the route to the other.
If there's a folder in your public folder with the same name as your route, that could cause this.
Change the name of 'public/used' or the name of your route. Whichever is easier.

Page forwarding with transfer of parameters called in URLs from one folder to another

In my wordpress page, links are addressed in the way:
www.mywebsite.com/blog/?page_id=1234
And each number gives a different page. I would like to have a forwarding mechanism that would forward a page in the form
www.mywebsite.com/mypage/?page_id=1234
when done in the folder "mypage", to the other folder "blog" as:
www.mywebsite.com/blog/?page_id=1234
with transferring each variable I have on the URL (in this case the only variable is page_id, and I would like to have all the variables forwarded to another page).
I'm pretty experienced in HTML and C/C++, but a beginner in PHP (though I've noticed that PHP is very similar to c in its logic, and I've done many changes in my Wordpress page based on my knowledge in C).
How can I do such a forwarding of code? Is it possible?
If there's any information missing, please let me know.
Thank you for any efforts.
This website gave a good tutorial on this. It took me 15 minutes to implement the solution.
http://html.net/tutorials/php/lesson10.php
SESSION if you want it to be specific for every user, POST if you dont want to change the url and the same for every user.
Im not really sure I understood your question.

Whats up with this google url?

So I know a little bit of PHP, and while I was making custom search links I realized that today google's url after searching something like "hi" isnt just
http://www.google.com/search?q=hi
instead its this
http://www.google.com/#sclient=psy&hl=en&site=&source=hp&q=hi&pbx=1&oq=hi&aq=f&aqi=g5&aql=&gs_sm=e&gs_upl=1705l1911l0l2131l2l2l0l0l0l0l173l299l0.2l2l0&bav=on.2,or.r_gc.r_pw.r_cp.&fp=6c03fc000f912511&biw=1366&bih=681
Just wondering if someone has some insight as to what kind of info the rest of the url is passing along
Some examples of the data passed along:
hl=en #Locale: english
source=hp #Source: homepage
q=hi #Query: hi
In general, it's just whatever extra data that Google wishes to capture or pass along. As you've probably noticed, it's not required data in the sense that http://www.google.com/search?q=query works fine.
The 2nd one is likely an addressing string. This is often used for navigating without full page loads. This way a user can press the back button without going back to a previous url.
If you notice, outside of all the parameters passed, the real difference is:
www.google.com/#
vs:
www.google.com/search?all_the_name=values&
The first example there is no page defined, the pound symbol tells it to stay where it is. Google has a feature that loads the results as you type (not the auto suggest) but the entire page. I can't seem to find how to trigger this though.

CakePHP How to call command that was calling from different file before?

I'm again lost with CakePHP.
Before site was using "static" one page invite for users from twitter, and now, I want all of those on one page.
I menage to create it for Facebook, but I can't for twitter.
I find controller file, it's the same for both, routes.php is redirecting on same way for both, I find file that is rendering in this command, but when I try to use:
$this->renderElement('fetch_twitter_contact');
It get's it all wrong.
And if it's called from original file it's all working okay.
I checked original file and it doesn't have anything different than this new have ( no special commands in front ), but still something is different.
Can someone tell me what else is deciding which codes will be run if file name is different?
How can I turn same functions to work in new file like it was working in old one?
New file have name index.ctp, and old one had social_contacts.ctp
New link is friend_invites/ and old one had friend_invites/social_contacts ( or friend_invites/social_contacts?contect=twitter )
It's 6AM here, and I'm still busting me head off with this.
Please help.
Your question is very difficult to understand. I suggest you get some sleep and clean up the question a bit so we can help :)
From what I understand, you're trying to call fetch_twitter_contact from two different views, but it only work from 1 view? Is this the problem?
Please go through this list and update your question
Have you set debug to 2 in core.php? If not, please do it
Are you getting any error messages? Post them in this question
Where is the element stored? In the elements folder or in a different folder inside the view folder?
It get's it all wrong. What does this mean? What goes wrong? What do you expect to happen?
Can you post the FULL url and associated views you are trying to use?

Categories