Introduction to the PHP Templating API Print

  • 0

Introduction

Within our PHP templates, our system works in a way where specific variables are available to the templates based on the page they are on. These variables are created by the system before template code is being run.

For instance:

/members/index.php

On the index page, there's a variable called $sets available which lists the newest sets.

/members/category.php?id=10

On this page, if this is a non-model category, the $sets variable will list the sets available on this page, based on which category this is, and which order the system is set to show these sets.

/members/gallery.php?id=1&type=vids

On this page, for instance, you'll have a variable named $media that shows content that is associated with this set.

This works well within our standard templates, since our standard templates are coded in order to show information that is available on that specific page.

The Problem

The problem comes into play if you wish to fetch content on a specific page that is NOT part of the normal page's variables.

For example, if you want to embed the newest movie on your home page. In this case, $media is not available on the index page, so embedded the movie file becomes a lot harder from a design perspective, often involving either direct database queries (NOT ADVISED) or AJAX calls in order to show the information.

As another example, say you wish to show the newest sets on your blog page. In this case, $sets is not available on your blog page so showing the newest sets becomes a lot harder from a design perspective. Just like the above example, getting around this limitation involves either direct database queries or AJAX calls in order to show that element of the page.

The Solution

In order to get around this, we have provided version 1.0 of our PHP Template API so that specific information about scenes and sets can be fetched on ANY template page.

Examples

Let's take first example up above. If you want to get media and file information about a specific scene on your front page, you can do;
$media = $api->getContent(["id" => $id]);
By making this call the $media element becomes available to your templates, and you can code any page to embed movies without much trouble.

In our second example, this is also easily fixed in our template API:
$sets = $api->getSets();
Now that this information is made available, you should be able to show newest sets, or specific sets anywhere.

API Calls

Here are a list of API calls currently available. Please click on each of these for more detail on what these do, and how to implement them in your templates.

The getCategories() function gets a list of categories that are present in the system.

The getComments() function gets a list of comments that are present in the system.

The getContent() function returns a list of content files (videos and movies) that are affiliated with a specific set id.

The getDVDs() function gets a list of DVDs that are present in the system.

The getModels() function gets a list of models that are present in the system.

The getNews() function gets a list of news entries that are present in the system.

The getSets() function gets a list of sets that are present in the system.

The getVodAreas() function gets a list of areas that are present in the system which are VOD areas.



Was this answer helpful?

« Back

This site uses cookies to personalize content and to analyze traffic. You consent to our cookies if you continue to use our website. Read our Privacy Policy to learn more. Please Agree or Exit