This page describes how to integrate Stash into your existing website as well as how to customize the templates.
This assumes that you already have a website built that you wish to have your Stash content displayed in.
The first thing to remember when setting up your pages that will use stash is to save them with a .php extension. This allows your server to use it's php engine to parse the document.
Next, you need to include at the very top of every page that you call Stash content:
<?php include_once '/path/to/stash/stash.inc.php' ?>
If you have a header file place that code at the top of it.
Example:
<?php displayNewsStash('featured', 6, false, true, 'news.php', 50); ?>
displayNewsStash() - This displays all news related content. There are 6 variables you can use to choose how your data is shown: Type, Count, Pagination, Comments, View More, Word Count.
Type - This is how you specify which template to use. You can choose between featured and default. Usually featured is used to display your index page news, this is often a shorter list of news post.
Count - This will be the number of post you would like to display at one time. You can enter any number you like here.
Pagination - This tells Stash that you would like to paginate your news posts. In order for Pagination to work you need to use this function with the Paginate Function. You can choose between True and False.
Comments - In addition to being able to turn comments on and off on a per news post basis in the admin tool. You can also disable them completely. You can choose between True and False.
View More - This tells Stash were to link to view all of your news. Simply put this is the file of the news section of your site.
Word Count - Stash will chop off the end of long news posts and prompt the user to click a link to view more of the post. This number is the number of words each post will have.
Example:
<?php displayTourDatesStash('upcoming', 12, true, 'oddrow', 'evenrow'); ?>
displayTourDatesStash() - This displays all tour date related content. There are 5 variables you can use to choose how your data is shown: Type, Count, Pagination, Even Row Class, Odd Row Class.
Type - This is how you specify which template to use. You can choose between featured, upcoming tour dates, and past tour dates. Usually featured is used to display your index page tour dates, this is often a shorter list of upcoming tour dates.
Count - This will be the number of tour dates you would like to display at one time. You can enter any number you like here.
Pagination - This tells Stash that you would like to paginate your tour dates. In order for Pagination to work you need to use this function with the Paginate Function. You can choose between True and False.
Odd Row Class - This is a class name for your odd rows. If you would like to alternate row colors to make your tour dates more readable this is how you do it.
Even Row Class - This is a class name for your even rows. If you would like to alternate row colors to make your tour dates more readable this is how you do it.
Examples:
<?php displayReleaseStash('discography', 'release.php'); ?>
<?php displayReleaseStash('release page'); ?>
<?php displayReleaseStash('track list', ' ', ' ', 'rowodd', 'roweven'); ?>
<?php displayReleaseStash('featured', '', 1); ?>
displayReleaseStash() - This displays all release related content. There are 5 variables you can use to choose how your data is shown: Type, View More, Count, Even Row Class, Odd Row Class.
Type - This is how you specify which template to use. You can choose between featured, discography, release page, and tracklist. Usually featured is used to display your index page featured releases. Usually release page is used as the releases main info page. Usually discography is used to list all releases. Usually track list is used to list the tracks on the releases page
View More - This tells Stash were to link to view the releases information. This should be used if you Type is discography.
Count - This will be the number of releases you would like to display at one time. You can enter any number you like here. This is mostly used just for featured releases, and often just set at 1.
Odd Row Class - This is a class name for your odd rows. If you would like to alternate row colors to make your track list more readable this is how you do it.
Even Row Class - This is a class name for your even rows. If you would like to alternate row colors to make your track list more readable this is how you do it.
Example:
<?php displayVideoStash('featured', 200, 166, 'javascript', 1); ?>
displayVideoStash() - This displays all video related content. There are 5 variables you can use to choose how your data is shown: Type, Width, Height, Embed Type, Count.
Type - This is how you specify which template to use. You can choose between featured, default. Usually featured is used to display your index page featured videos.
Width - This tells Stash the width you would like the video player to be.
Height - This tells Stash the height you would like the video player to be.
Embed Type - This tells to use which type of embed to use. You can choose between standard and javascript. If you use javascript to embed the player you MUST download and use SWFObject on your page.
Count - This will be the number of videos you would like to display at one time. You can enter any number you like here. This is mostly used just for featured videos, and often just set at 1.
Example:
<?php displayPagination('upcoming tour dates', 12); ?>
displayPagination() - This displays creates your pagination. Pagination is only currently supported for News and Tour Dates. There are 2 variables used to paginate your data shown: Type, Count.
Type - This is how you specify which data you are paginating to use. You can choose between news, upcoming tour dates, and 'past tour dates.
Count - This number must be the same as the count number you used on the function to call in the data (ex: if you have a page with news and you are limiting it's count to 10 posts, then your pagination function for news needs a count of 10 also).
Example:
<?php displayRssStash('news.php', 'RSS'); ?>
displayRssStash() - This displays creates a link you your news RSS feed. There are 2 variables used to paginate your data shown: View More, Link Text.
View More - This tells Stash were to link to view all of your news. Simply put this is the file of the news section of your site.
Link Text - This is the text you want the link to wrap around. You can also put in an image tag instead (ex: <img src="path/to/rss_icon.gif" alt="My RSS feed" />).
Example:
<?php displayPlayerStash('ffffff', false, 'javascript'); ?>
displayPlayerStash() - This displays your mp3 player. There are 3 variables used to paginate your data shown: Color, Auto Play, Embed Type.
Color - This tells Stash what color you would like for the player. You must only enter in the hex value of the color (ex: #ffffff or ffffff). Short format is not excepted, must be 6 characters long.
Auto Play - This is tell Stash to have the player start playing or paused. It is recommended to have Auto Play set to false, unless the player is opened in a new window.
Embed Type - This tells to use which type of embed to use. You can choose between standard and javascript. If you use javascript to embed the player you MUST download and use SWFObject on your page.
The key to getting Stash to integrate into your existing website are the templates. I will explain the easiest way to get templates working for your site.
In this example I will be talking about displaying your news posts. Start by creating your news styles using only standard xhtml and css. Do not worry about plugging in dynamic content at this stage. Only concentrate on how one news post will look.
At this stage the code for the div that wraps a news post might look like this:
<div class="newspost">
<h2>07-29-2007</h2>
<h3>My First News Post</h3>
<p>This is my news post body.</p>
<p class="postfooter">Posted by Your Band 0 comments</p>
</div>
Now that you have the news post's structure, copy this code and log into your admin area. Go to Customize and click News. Now past the code you copied into the text area. All that is left to do is, replace the static data with Stash's tags. Your Code would now look like this:
<div class="newspost">
<h2>{date]</h2>
<h3>[title]</h3>
{body}
<p class="postfooter">Posted by {author} [com-link]{com-number} comments[/com-link]</p>
</div>
One of the most important things to remember when working with templates is. If you open a tag in the template you must close that tag while still in the template. So if you want to display your content in a table, the <table> tags must come before and after were you call in your content. How ever the <tr> tags must go within the template.
If you are still unsure on how Stash will fit into your existing site, here is some sample website code.
<?php include_once '/path/to/stash.inc.php'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="stylesheet" href="/path/to/style-sheet.css" type="text/css" media="all" />
<script type="text/javascript" src="/path/to/swfobject.js"></script>
<title>My Band Site</title>
</head>
<body>
<div id="wrapper">
<div id="header">
<h1><a href="/">My Band Site</a></h1>
</div>
<ul id="nav">
<li><a href="/news.php" class="news">News</a></li>
<li><a href="/shows.php" class="shows">Shows</a></li>
<li><a href="/discography.php" class="disco">Discography</a></li>
<li><a href="/band.php" class="band">Band</a></li>
<li><a href="/media.php" class="media">Media</a></li>
<li><a href="/links.php" class="links">Links</a></li>
<li><a href="/contacts.php" class="contacts">Contacts</a></li>
</ul>
<div id="content">
<div class="news">
<?php displayNewsStash("featured", 6, false, true, "news.php", 50); ?>
<p><a href="/news.php">view all news</a></p>
<?php displayRssStash('news', 'news.php', 'RSS'); ?>
</div>
</div>
<div id="sidebar">
<?php displayPlayerStash('ffffff', false, true); ?>
<div class="release">
<?php displayReleaseStash("featured", "release.php", 1); ?>
<p><a href="/releases.php">view all releases</a></p>
</div>
<div class="video">
<?php displayVideoStash("featured", 200, 166, "javascript", 1); ?>
<p><a href="/media.php">view all videos</a></p>
</div>
<div class="shows">
<table>
<tr>
<th class="date">Date</th><th class="location">Location</th>
</tr>
<?php displayTourDatesStash("featured", 5, false, "row1", "row2"); ?>
</table>
<p><a href="/shows.php">view all shows</a></p>
</div>
</div>
</div>
<div id="footer"></div>
</body>
</html>