Intrepid is the easiest way to embed dynamically changing quotes into your website. Built using PHP and XML, this API is simple to use and modify to fit your website. The quotes come from all around the web, and accumulated over the past few years. You can also contribute by Suggesting a Quote.
Intrepid API can be used and modified by anyone with working knowledge of PHP and XHTML. Credits must remain in the head of the script, and redistribution without permission is prohibited.
Its quite easy! Download the latest release from the Download page. Extract the zip file into the directory you want the API to reside in your server.
Then you will need to call the API in the page you would like it to show up on. This is done using a simple PHP include().
<?php include("path/to/api/intrepid_api.php"); ?>
As of the 1.0 release there are two functions that you can call upon. One to display a single quote at random, or by direct input and the second to list all the quotes in the quotes.xml file.
The first of these functions has 4 parameters that need placed for it to work properly.
$author - This is the variable that tells the function the author to display.
$text - This is the variable that tells the function the quote text to display.
$direct - This is the variable that will allow a single quote to be displayed, rather than a random selection.
$social - This is the new boolean variable for showing or hiding the social components.
Example: <?php Quote($author,$text,$direct,true); ?>
To call a direct quote from your quotes.xml file, you must do it through the url string. In your URL call a parameter id with the number of the quote you are referencing.
URL: http://divisionoverlay.net/projects/intrepid/index.php?id=44
This will display the proper quote for that ID in your quotes.xml file.
To disable the social components (Twitter and Facebook buttons) set the last parameter to false
This function is a slightly more complex, and will list all quotes in numerical order based on the id.
$author - This is the variable that tells the function the author to display.
$text - This is the variable that tells the function the quote text to display.
$list - This is a boolean variable that tells the function to list one or all of the quotes
$i - This variable is the number of quotes in the file. Simply to return amount to quotes in file.
Example: <?php QuoteList($author,$text,true,$i); ?>
Setting the list parameter to true will list all the quotes in order, false would fall back to the Quote() function, and only display a single quote at random.
Intrepid comes pre-built with twitter "tweet" button, and Facebook "like" buttons into the core. These will use a specific ID of the quote the user is currently looking at. There is no additional writing necessary on the backend unless you want to custom build some new social components, in which case, I'd like to hear about it!
The Intrepid API will gather the appropriate information about your server, and location of the page being viewed. then add them to the share URL where needed.
//For Dynamic URLs
$domain = "http://".$_SERVER['SERVER_NAME'];//Server name
$dir = $_SERVER['REQUEST_URI'];//folder/page
$url = $domain.''.$dir;//string them together for a complete url