In a view of joomla registration module, there is the string:
"registration.register"
What about this sintax?
The call bypass the controller and call a particullary function?
It calls the function named "register" in the controller named "registration".
You can find that function inside the file "registration.php" in
/components/com_users/controllers/registration.php
Related
I'm trying to make a separate function checkUser insede BaseController. But page redirection is not working inside this function. Even inside __construction() function this is not working also. But when I use it in initController or any other controller function, then this is working. How can I solve this problem, please guide me.
BaseController (In my case AdminBaseController)
This is Dashboard Controller
Showing this error
As you can see in the CI4 documentation, initController() is called after __construct(). Then, when you call checkUser(), your response object is still not initialized, thus null.
You could move the code of your __construct() method into the initController() method, in your AdminBaseController.
I am new in Codeigniter and it's one of the good frameworks of php. But on some conditions I'm confused. Like this one. If any of you have any clarification about my dough, it's a great help for me.
Offcouse redirects refresh the page and $this not but apart from this I want to know - anyhow both of them used to go to somewhere else on view pages or like in other controller or in same controller to other methods.
But we don't use these side by side because when getting any of them it will go to that page or method without checking the next lines.
In case of a normal difference then have lot's of but I just want to know about the condition of going to next page or method when we use redirect or $this like this -
$this->Function($value); //It's method of same controller.
redirect('Controller/function'); //It's also doing same with page reload.
Thank for looking my problem.
Redirect()
When you will call any function of helper in codeigniter then you can call function directly without using any object. Helper in Codeigniter is collection of functions.
Redirect() method is a part of URL helper in Codeigniter.
For your ref. https://www.codeigniter.com/user_guide/helpers/url_helper.html
So, just load helper using $this->load->helper('url'); or you can also mention in autoload.php file.
$this->Function(); used to call a function from same controller
$this->Function(); used to call a function from same controller
redirect()
While building a web application, we often need to redirect the user from one page to another page. CodeIgniter makes this job easy for us. The redirect() function is used for this purpose.
redirect($uri = '', $method = 'auto', $code = NULL)
The first argument can have two types of URI. We can pass full site URL or URI segments to the controller you want to direct.
The second optional parameter can have any of the three values from auto, location or refresh. The default is auto.
The third optional parameter is only available with location redirects and it allows you to send specific HTTP response code.
Redirect means jumping to another function mentioned in the redirect method.
$this->Function($value); => jumping to another function and you can execute the code of the same function as well as pass the value back by returning value.
When you send request to codeigniter generally CI controller gets called and then function which is mentioned in uri segment. like below... So this will be another request.
redirect('Controller/function'); //It's also doing same with page reload.
But when you have to call another function within the same request then you can use below approach
$this->Function($value); //It's method of same controller.
This will execute the given function and return the value within same request.
I have this action defined in my form.phtml (Environment is magento).
form action="getUrl('contacts/index/post')
Now I need to know which controller is getting called so I can get the values in the backend.
That is pretty straight forward.
The first word contacts is the front-name which in magento standards is the module name. The second word index is the controller file name and the last word post is the action of the controller.
Because thats a core controller, you can find the file under /app/code/core/Mage/Contacts/controllers/IndexController.php
Look at the postAction() function.
I am attempting to declare a method/function in my controller that responds to a numerically named route. When I load any page in the site I receive an error stating the controller method could not be found, meaning that Laravel won't even load the application do to some incorrect formatting. I searched for an answer with no luck.
Here is the route I'm attempting to access via my Math controller:
students/academics/math/7-12
Here is the method declaration to look for the route:
public function get712()
Which gives me the following error no matter what page I'm loading:
Call to undefined method Illuminate\Routing\Router::get712()
I'm not sure how to name the function/method in my controller for a purely numeric routes since hyphen is not allowed and there is no upper/lowercase for numbers.
why not pass 7-12 as a variable to a method?
route:
students/academics/math/{number}
controller:
public function getMath($number)
{
// code here
}
I remembered that Laravel used to use underscores in the method name instead of camelCase so after scouring Google with no luck I declared the method like this:
public function get_7_12()
voila!
In my view I create links via:
URL::action('NotSureWhatController#getIndex', 'id') }}
My view is a template that is used by a variety of different controllers, what's the best way to change the name of the controller in the action?
The only thing I can think of is setting a var in the controller and passing it through.
Is there a better way? Or a way to get the controller name?
I can't use 'as' in the route to name the controller either (as this is used for something else) so this won't work:
Route::currentRouteName()
Option 1
You should create the URL directly in the controller, then pass it as a variable to the view. The view will just print the url.
Option 2
You pass the name of the controller as a variable to the view (always from the controller), then you use the escape values of the blade templating to print it inside your function to generate URLs.
Option 3
Using the REQUEST class to get information about the page.