Welcome back.
Now what we need to do is that we need to use this function in order to get the in order to get in order
to get the response array and display the headlines in our website.
So I'm going to open up the index and in order to call this function from the index, we need to import
the functions, saying the index.
What I'm going to do is that at the top, we need to say each bead.
And then be scrapped and then you need to say include once.
And then you need to pass the functions.
Not speech, and since now we have these functions included in the index, what we want to do is that
we want to use we want to call the convert into array function because this function will return to
the response array.
This function makes the call and returns the array.
So what I'm going to do here is that I'm going to open up a new BGP script.
And then I'm going to call the function, I'm going to say convert.
Into Iraq, and then I'm going to store the result in a new variable called response rate.
So response array is going to be equal to converting to our.
Now this is an area, and since this is an area we can loop over it, we can loop over it and display.
Remember, we can display the headlines of the objects that we have in the articles everyday.
So to do that here, we need to use while or for each day I'm going to be using for each and I'm going
to be using get here and I'm going to use this.
I'm going to say here for each.
I'm going to say I'm going to open up a B2B script and then I'm going to say for each or each, what
for each.
Response array as.
As elements.
Because each single inside inside their response area, we will have elements or objects, let's say
object.
And then here can brackets and then closely BHP script, and then here I want you to open a BHP script
and then I want you to close the curly brackets.
So the opening curly bracket will be here and the closing curly bracket will be here.
However, we need to access the key first, remember, the key was articles.
So this this response array will contain everything.
It will contain also the the other keys, and we don't want the other keys and said we want the articles
itself.
Therefore, you need to say in your articles, you need to up in eight square brackets and then single
quotes and then articles.
Articles, so responsively articles as object and thou here, what we can do is that we can leave me
remove this.
We don't need this.
This is a mistake.
What we want to do here is that we want to use this object to display the single key we have or the
most important things.
So what is the most important key in use headline?
Obviously, it's the title.
The title is the most important key.
Therefore, here.
Remember, we have.
We have a year God title.
I'm going to say Beach B. And then I'm going to say Eko, and then I'm going to echo the object.
However, we need to access a specific thing from the obvious we need to as specifically.
So the key that they want to display here is the title.
I'm going to display the title here.
I'm going to say title.
Similarly, for the.
For other guys, what else do we want to display, we might want to display this description, so the
description contains more information about the that news article.
So here I'm going to say Beach B and then A. and then object.
And then what was the key?
Let me take one more time.
So the key was description.
So here I'm going to say.
Description.
Similarly, for the image you remember, we have this image.
So what are the images we need to say source and then equals through double quotes and then I'm going
to be scrapped.
And then I'm going to say A. And then object.
And then here, what is the what's the key for the image?
So the key for the image is you are able to image and you need to pay attention to the characters here.
We have camel case you are able to image.
So here I'm going to say you are ill to image your health, your image.
You can also display other things, such as the published at the content that you are ill.
The author let's display, for example, the author you can hear.
Copy this.
And this would be law, and then you can hear say other.
The author, the author is author.
So here I'm going to say first author.
And the key here is going to be water.
Let me now save and let's say then over to the browser to test.
So now in the browser, let me refresh and as you can see, we will have here, as you can see, we
all have news headlines and each news a line has image and headline description.
Anything but the problem is that we need to work on the design.
The images are too small, so let's change the size of the image.
So I'm going to open up the CSIS folder.
And then in this case, I'm going to change the width of the image instead of 75, let's say 200.
I'm going to say 200.
Now let me refresh and the images should be much bigger.
As you can see, they are now 200.
You can even increase this to three 300.
I think 300 would look amazing.
Let me say three hundred.
And here I have an early meeting over this point.
Now let me refresh one more time.
So now we should get 300, so 300 is better, but 300 with this design, we need to decrease the number
of news headlines per corporal.
So instead of saying here three, let's say four, I'm going to say here four.
And this is going to fix it.
So now if it doesn't fix it, then if it doesn't fix it, then we need to do one of two things.
The first thing is to decrease this number.
Or we can say 100 percent, 100 percent.
We'll make sure that the image will not go outside the the parent.
As you can see, it's going to take exactly the width of the parent, which I think, look, which looks
now amazing.
So we will have all of these news headlines.
And finally, the problem that I I want to
I want to fix is that here we shouldn't be displaying the description.
This one just protesting the displaying the description like this would ruin the website.
Look, because we just want to display the headline itself and then the description or the complete
article should be displayed only if the user is interested in that specific piece of news.
And I'm going to be showing you a technique to display the description only if the user is.
Is interested in a specific news headline.