Jamroom Logo Jamroom 5 Core
is now Open Source!
User Support Forum Archive (Read Only)
Third Party Products and Support:
jamroom smarty functions
blindmime



Joined: 07 Mar 2004
Posts: 1107

Posted: 10/28/06 18:12 
I'm sorta curious if anyone has created some custom smarty functions for jamroom. I created my first one based on a random function in the smarty docs. My function outputs a word from an array within the function that feeds flickr a tag word to output for this image flash player:

http://geekkid.net/viewr/

geekkid also has an updated xspf player with additional functions, for those of you interested in that.

Here's the code for my function, FWIW:


Code

<?php
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * File:     function.randomviewrtag.php
 * Type:     function
 * Name:     randomeviewrtag
 * Purpose:  outputs a random tag for the flash viewr
 * -------------------------------------------------------------
 */
function smarty_function_randomviewrtag($params, &$smarty)
{
    $answers = array('altrock','jazz','blues','guitar','punk',
'concert','radio','cdr','bass','ipod','mp3','recording','noise','cassette',
'4-track','synthesizer');

    $result = array_rand($answers);
    return $answers[$result];
}
?>


Save it as function_randomviewrtag.php.

Once you put that in include/plugins/smarty you can use {randomviewrtag} to output the random words you place in the array above.

Sort of a test to see how the smarty functions work in jamroom.

Pretty cool!


_________________
tapegerm.com
homemademusic.com
Back to top
Brian
Jamroom Team


Joined: 09 Jul 2003
Posts: 37583
Location: Seattle, WA

Posted: 10/28/06 19:11 
Smarty rocks Wink

the custom functions, blocks and modifiers you can create in Smarty really allow you to do almost anything you want, and make it fairly easy. Over the life of Jamroom 3 you'll see more and more "helper" template functions work their way into Jamroom to make doing fun things in the templates easier.

- Brian


_________________
Make sure and check out:
* The Jamroom FAQ
* The Jamroom Documentation
Back to top
Display posts from previous:   
User Support Forum Archive (Read Only)
Third Party Products and Support

 
Solutions
• Social Media Platform
• Social Networking Software
• Musician Website Manager
• Community Builder
Products
• Jamroom Core
• Jamroom Addons
• Jamroom Modules
• Jamroom Marketplace
Support
• Support Forum
• Documentation
• Support Center
• Contact Support
Community
• Community Forum
• Member Sites
• Developers
Company
• About Us
• Contact Us
• Privacy Policy
©2003 - 2010 Talldude Networks, LLC.