GithubHelp home page GithubHelp logo

List of film genres about tmdb_v3-php-api- HOT 11 CLOSED

pixelead0 avatar pixelead0 commented on September 15, 2024
List of film genres

from tmdb_v3-php-api-.

Comments (11)

bogdanfinn avatar bogdanfinn commented on September 15, 2024

Hello @HellsAngels
where is the code provided you mentioned in the beginning? can't find it in the examples of this repository.

Nevertheless your code example and your error message are somehow not related.
In your code you iterate over the genres of a movie (when they exist) and print the name of the genre.
But your error message is for getting the Id of a Genre.

Maybe you can provide further details on what you are doing, how you are doing it and what you want to achieve?

from tmdb_v3-php-api-.

DarKl4ne avatar DarKl4ne commented on September 15, 2024

the error reports this code to me Genre.php line 49
return $this->_data['id'];

What I want to do is display the Genres. But in Movie.php this $this->_data['genres'] code gives me this error!
Undefined index: genres in C:\wamp64\www\tmdb_v3-PHP-API--master\controller\classes\data\Movie.php on line 106

And if I put this $ this->_data['genre_ids'] it is this error
Trying to access array offset on value of type int in C:\wamp64\www\tmdb_v3-PHP-API--master\controller\classes\data\Genre.php on line 49

And I call the genre like this
foreach($movie->getGenres() as $genre){
echo ''. $genre->getName() .'';
}

I do not know what to do. Yet your code works well except genres

from tmdb_v3-php-api-.

bogdanfinn avatar bogdanfinn commented on September 15, 2024

Is it the Detail of a Movie or for example a search result of a movie? Are you iterating over a movie list?

From which endpoint do you get your movie / movies?
For example when you first search for a movie by keyword and receive a movie list and then want to display the genres of each movie (search result) then you only have the genre ids.

Will look into this Genre thing and hopefully provide an example.

from tmdb_v3-php-api-.

DarKl4ne avatar DarKl4ne commented on September 15, 2024

It’s while searching for a movie, so it’s just the genre IDs that it displays ,? If so, what would be nice is that with genre IDs we can have a list of genres.

You were talking about it here (#40) and it is on this discussion that I tried to display the genres, but I had not seen that it was just on the info of a film and not the research

from tmdb_v3-php-api-.

bogdanfinn avatar bogdanfinn commented on September 15, 2024

@HellsAngels
You can have a look into the official API Docs.

Movie Details:
https://developers.themoviedb.org/3/movies/get-movie-details

Movies in Search Results:
https://developers.themoviedb.org/3/search/search-movies

Look into the Responses. There you will see that on the Details Endpoint you receive the Genres Array on the Search Endpoint only an Array of Genre Ids.

That means when you want to display each Genre Name for a Movie search result you have to iterate over the ids and fetch the genre details. Unfortunately there is currently no function for fetching Genre Details by Id.

from tmdb_v3-php-api-.

bogdanfinn avatar bogdanfinn commented on September 15, 2024

@HellsAngels
I added some examples for genres in my latest commit on my fork check them out:
https://github.com/bogdanfinn/tmdb_v3-PHP-API-

That means when you want to display each Genre Name for a Movie search result you have to iterate over the ids and fetch the genre details. Unfortunately there is currently no function for fetching Genre Details by Id.

But fetchig the genre details is only one API call. See the examples. then you receive a list of genres and you only need to filter the genres you are intereted in. You dont have to do an api call for each genre

from tmdb_v3-php-api-.

DarKl4ne avatar DarKl4ne commented on September 15, 2024

Ok thank you I will go see the details of the API. And sorry for the inconvenience because actually during the search we only have the gender IDs.

from tmdb_v3-php-api-.

pixelead0 avatar pixelead0 commented on September 15, 2024

@bogdanfinn Can you do a pull request?

from tmdb_v3-php-api-.

bogdanfinn avatar bogdanfinn commented on September 15, 2024

@pixelead0 created one for all 3 open issues

from tmdb_v3-php-api-.

bogdanfinn avatar bogdanfinn commented on September 15, 2024

@pixelead0 issue can be closed

from tmdb_v3-php-api-.

pixelead0 avatar pixelead0 commented on September 15, 2024

thanks @bogdanfinn

from tmdb_v3-php-api-.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.