Special Views

The functions | Usage

Currently, there are four special views available in phpPortfolio. These are views that can be used to add dynamic content to other areas of your website, and to help direct traffic from these areas to your portfolio. For instance...

Functions

randomPiece() This function renders a simple table that contains a randomly selected piece's Title, Thumbnail, Client, Media, Sector, and a teaser of the Description. The thumbnail is clickable to the piece's details page.

randomPieceSimple() This is similar to randompiece() except that only a clickable Thumbnail and the Description teaser is rendered.

randomPieceSpecific($media_id) This function will render a clickable thumbnail image to the page, right-aligned, that is restricted to the media type passed to it as an argument. For instance, if you had a page called internet on your site, you could place a randomly generated example from your portfolio on the page, that is only drawn from the pieces in your portfolio classified as media type = internet.

randomProject() This is the project equivalent of randompiece().

Top

Usage

Using these special views is pretty straight forward. Assuming you haven't changed the names of your portfolio directories, you would add lines something like the following example to the page you wanted to include the special view on...

	include_once("portfolio_app/config.php");
	include_once ("portfolio_app/portfolio_functions.php");
	$random = randomPieceSimple();
	echo "$random";

If you wanted to use randomPieceSpecific(), you would first have to check the ID value for the media you wanted to select from. One way you can do this is by looking in the location bar in your browser when viewing a details screen for the media you wish to feature. For example, the ID number for 'Branding' in the demo data included in phpPortfolio's installation is '4'. Once you know the ID number of the media you wish to select from, you would add lines such as the following to the page you wish to place the random content on.

	include_once("portfolio_app/config.php");
	include_once ("portfolio_app/portfolio_functions.php");
	$media_id = "4";
	$random = randomPieceSpecific($media_id); 
	echo "$random";

Top

© phpPortfolio