Jump to content

These Forums Are Now Read-Only

For TubePress support, please post a question here or open a support ticket and we will be glad to assist.


Looping through videos in playlist.

  • Please log in to reply
1 reply to this topic

#1 Jason Fluteere

Jason Fluteere


  • Members
  • Pip
  • 1 posts

Posted 19 January 2011 - 11:38 PM


I bought tubepress pro today and I'm wondering how I might be able to get started with the following...

I'd like to skip using the tubepress templates and simply use the tubepress API to 1) Get a all the videos in a given playlist and 2) Loop through them and print out certain information about each video in my own template. I'm assuming this can be done is straight php... For example, I see in your template files you have a $videos array that hold such data. Anyhow, I looked through the docs but they are pretty sparse (unless I missed something...).

If that wasn't descript enough, here's an pseudo-code example:

Say I'd want to display a ordered list of video descriptions:


//get video array
$videos = some_function_to_get_videos_from_playlist("PLAY_LIST_ID");

    for ($video in $videos) {
    echo "
  • " . $video->description . "

  • }


Can anyone point me in the right direction?



#2 eric


    Lead Developer

  • TubePress Staff
  • 2787 posts

Posted 26 January 2011 - 12:59 PM

Hi Jason,

Sorry just getting back to you now. Your pseudocode is 90% there. I think the piece you're looking for, something to just retrieve the raw video array from PHP and nothing else, unfortunately doesn't really exist. That said, you can get what you're after by using a very simple TubePress theme. In your case, the theme would have just a single gallery.tpl.php file with the following contents:

<ul>    <span class="syntaxdefault"><?php foreach (${org_tubepress_template_Template::VIDEO_ARRAY} as $video): ?>        <li><?php echo $video->getDescription(); ?></li>    <?php endforeach; ?></ul></span>
Then anywhere you want to use this, just call

print tubepressGallery("theme="mytheme" mode="playlist" playlistValue="someplaylistid" ...);
Do you think that gets you started in the right direction? Again, sorry it took me so long to respond. TubePress Pro usernames should show up in green, but apparently I haven't found a fix for this bug yet.