How to use PHP to determine whether the ID value of the loop div is empty, if it is not empty, the div layer is displayed normally, if empty then hidden?
The following code is my code.
Do not know whether to use PHP to determine the efficiency of high or the use of JQ judgement efficiency.
To try without API key: $video _list = Json_decode (file_get_contents (")); $video _list = Json_decode (file_get_contents ( ' https://www.googleapis.com/youtube/v3/search?order=date&part=snippet&channelId= '. $channelId. ' &maxresults= '. $maxResults. ' &key= '. $API _key. '); foreach ($video _list->items as $item) {//embed Video if (isset ($item->id->videoid)) {echo ' Id->videoi D. ' "class=" xl12 xs6 xm4 xb3 video-box "> Id->videoid. '" target= "_blank" title= "'. $item->snippet->title. ' " >id->videoid. ' class= ' radius img-responsive ' alt= '. $item->snippet->title. ' " >Id->videoid. ' " > '. $item->snippet->title. '
'; }//embed Playlist Else if (Isset ($item->id->playlistid)) {echo ' id->videoid. ' "cl ass= "xl12 xs6 xm4 xb3 video-box" > id->videoid "target=" _blank "title=". $item->snippet->title. ' " >id->videoid. ' class= ' radius img-responsive ' alt= '. $item->snippet->title. ' " >Id->videoid. ' " > '. $item->snippet->title. '
'; }}
The following code is the video list of the parent div,id= "here to get the video key ID number,"
Id->videoid. ' class= ' xl12 xs6 xm4 xb3 Video-box ">
Id->videoid. ' class= ' xl12 xs6 xm4 xb3 Video-box ">
Internal HTML
Because it is to take the video of foreign sites, so sometimes not to get the video key ID, so it cannot be loaded.
How to modify the above code implementation, Judge Id->videoid. ' "
Is the id= "value" empty, and if it is empty, the empty video message is hidden with the Display:none property of style or class?
Reply content:
How to use PHP to determine whether the ID value of the loop div is empty, if it is not empty, the div layer is displayed normally, if empty then hidden?
The following code is my code.
Do not know whether to use PHP to determine the efficiency of high or the use of JQ judgement efficiency.
To try without API key: $video _list = Json_decode (file_get_contents (")); $video _list = Json_decode (file_get_contents ( ' https://www.googleapis.com/youtube/v3/search?order=date&part=snippet&channelId= '. $channelId. ' &maxresults= '. $maxResults. ' &key= '. $API _key. '); foreach ($video _list->items as $item) {//embed Video if (isset ($item->id->videoid)) {echo ' Id->videoi D. ' "class=" xl12 xs6 xm4 xb3 video-box "> Id->videoid. '" target= "_blank" title= "'. $item->snippet->title. ' " >id->videoid. ' class= ' radius img-responsive ' alt= '. $item->snippet->title. ' " >Id->videoid. ' " > '. $item->snippet->title. '
'; }//embed Playlist Else if (Isset ($item->id->playlistid)) {echo ' id->videoid. ' "cl ass= "xl12 xs6 xm4 xb3 video-box" > id->videoid "target=" _blank "title=". $item->snippet->title. ' " >id->videoid. ' class= ' radius img-responsive ' alt= '. $item->snippet->title. ' " >Id->videoid. ' " > '. $item->snippet->title. '
'; }}
The following code is the video list of the parent div,id= "here to get the video key ID number,"
Id->videoid. ' class= ' xl12 xs6 xm4 xb3 Video-box ">
Id->videoid. ' class= ' xl12 xs6 xm4 xb3 Video-box ">
Internal HTML
Because it is to take the video of foreign sites, so sometimes not to get the video key ID, so it cannot be loaded.
How to modify the above code implementation, Judge Id->videoid. ' "
Is the id= "value" empty, and if it is empty, the empty video message is hidden with the Display:none property of style or class?
Directly with CSS
DIV[id=""] { display: none; }
WEB--JS. PHP, SERVER.
This API gets JSON. Isn't the data complete? Where is the ID for the data to be empty? That's weird.