It's regarding AngularJS $data - angularjs-ng-repeat

In our code below line is mentioned:
< tr ng-repeat="usrChanges in $data" >
I am using angularJS (angular1), I am unable to find the $data in Controller.
I want to do some operations on it before displaying on webpage.
Help me in storing data of "$data" in any other variable in controller.

$data should be attached to your $scope inside the controller or directive bveing used at the page. Try finding where you are assigning $scope.$data.

Related

Where to load View Parser service in Codeigniter 4

I am not understanding loading the parser service in Codeigniter 4, Please tell me how to load and where to load it, and how can i use it in View.
Load the parser inside of the controller method that you want to use it in e.g. inside of index() method of Home controller. You may load it using $parser = \Config\Services::parser(); or $parser = service('parser');.
Rendering a view can be done by echoing as follows:
echo $parser->setData($data)->render($view);
wherein $data can be something like ['blog_title' => 'My Blog Title', 'blog_heading' => 'My Blog Heading']; and $view is the address of your view file inside of /Views directory.
This will then replace any 'substitutions' in view file such as <h1>{blog_title}</h1> with your data. You can read more about the specifics of substitutions in docs.
Note: Using the Parser, your view templates are processed only by the Parser itself, and not like a conventional view PHP script. PHP code in such a script is ignored by the parser, and only substitutions are performed.

How can i include partial view conditionally according to the passing array from controller or not

I have a master view page where included multiple partial views passing array from controller.
i want to create a new page extends master.
But don't need all partial of master page into my new one.
So i want to include partial views into master according to passing array from my controller.
means * if i pass arrary from controller then partial view will be included else not.*
Offcouse foreach will be enable if the partial views getting array from the controller.
it can be done using if condition but i want to solve this using
includeIf() directive according to laravel documentation.
please suggest how can i achieve this.
You could do it like so:
#if(!empty($galleryImages))
#include('includes.home.photo-gallery', ...);
#endif
My suggestion is:
#if(!empty($photo_galaries))
#include('includes.home.photo-gallery', [
'photo_galaries' => $photo_galaries,
]);
#endif
Change the code from line 65 on file news-template.blade.php for this.
Hope it helps.

Whats the difference between redirect and this in Codeigniter?

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.

In codeigniter, var_dump($this) displays all the variables that are availible in the view

In codeigniter, If you use var_dump($this) you can see all the variables that are availible in your view. Database username and passwards are also visible. I am new to codeigniter, I do not know can this be misused or it is safe.
`var_dump($data)`
This is mainly used to display your structured information with type and value retrieved on your backend like model or controller etc.
Just refer the link to know more regarding var_dump and information on how to safeguard your credentials from var_dump(),var_export() and print_r().
Hope these reference's help you.
In codeigniter we call methods using $this. So there is 100+ $this lines.
if your want to check value of some variable, You have to
Assign value to variable.
ex: $array = $query->result_array(); //Model example
Then check it using
print_r
var_dump

Passing form data through MVC - Joomla

I'm creating a search form that shows a single user depending on the exact match of the first and last names and a member ID. I have the component shell set up with the form data going to a custom controller in 'com_medsearch/controllers/search.php'. I've read the tutorials in the Joomla docs, but I'm not sure how to pass the data to the model (com_medsearch/models/search.php) and the query results back to the same view. Answers?
You can do this 2 ways:
You detect that you had a search post in your controller then you call your model and in the model you can use JRequest::getVar / getInt / etc to read your variables.
You detect your search post and read your variables from the post all in your contoller function and pass it to your model.
Here is an example for point 2:
$settings = JRequest::get( 'POST' );
$model = & $this->getModel('settings');
$model->saveSettings($settings);
Then in your model you can access your post variables like:
$settings->input_name

Resources