Jamroom Logo Jamroom 5 Core
is now Open Source!
User Support Forum Archive (Read Only)
Jamroom Developers:
htmlGetTemplate and htmlShowTemplate
SteveX
Ultrabubble


Joined: 30 Aug 2005
Posts: 8792
Location: Ultrabubble

Posted: 01/19/09 14:07 
I have this working in a module smarty function, but I can't pretend that I am understanding it, and parts of it look wrong (I am not using ranking here). So I would appreciate a little advice as to how this should be done in this simple situation.

uj_sun.tpl (in the active skin directory):

Code
        <br />{$UJ_SUN_RISE} = sunrisetime
        <br />{$UJ_SUN_SET} = sunsettime



And pretty much copied from the jrYouTube example module,
function.ujSun.php (in the module smarty directory) contains:

Code
$_tpl = htmlGetTemplate('row_template',$_args,'ranking','uj_sun.tpl');

    ob_start();

        $_rep['UJ_SUN_RISE'] = $sunrisetime;
        $_rep['UJ_SUN_SET'] = $sunsettime;

        $_rep = jrArrayMerge($GLOBALS['JR_RANKING'][$key],$_rep);
        htmlShowTemplate($_tpl['tpl_dir'],$_tpl['template'],$_rep,$_tpl['theme']);

    $out = ob_get_contents();
    ob_end_clean();
    return($out);


So this gives me my desired {$UJ_SUN_RISE} and {$UJ_SUN_SET} in my uj_sun.tpl, but I know I am not using ranking and I am not sure what options I have with what I have working here, if you know what I mean Confused

I haven't been able to find the entries in the Jamroom function directory of any practical help with these particular functions, so any clarification as to how this section works would be greatly appreciated!

Thanks for any advice anyone can give!


_________________
Kulshi Mezian!

"Stranger from another planet, welcome to our hole. Just strap on your guitar and we'll play some rock and roll"

Ultrabubble create things.
Back to top
Brian
Jamroom Team


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

Posted: 01/19/09 14:15 
You really only need to use htmlGetTemplate() if you want your module to be able to support all of the different template parameters - i.e.

template
tpl_dir
skin
theme

(in other words the template can be located in any theme or skin directory, instead of the active skin directory).

The function merely ensures that the proper options get placed into the $_tpl array, so you don't have to do manual "checking" of these values before passing them to htmlShowTemplate().

Also, you do not need this:

$_rep = jrArrayMerge($GLOBALS['JR_RANKING'][$key],$_rep);

unless you are in the "process" section of a ranking system plugin. Most likely for your example here, you probably only need:


Code

ob_start();
$_tpl = htmlGetTemplate('template',$_post,'ranking','uj_sun.tpl');
htmlShowTemplate($_tpl['tpl_dir'],$_tpl['template'],$_rep);
$out = ob_get_clean();
return($out);


Hope this helps!

- Brian


_________________
Make sure and check out:
* The Jamroom FAQ
* The Jamroom Documentation
Back to top
SteveX
Ultrabubble


Joined: 30 Aug 2005
Posts: 8792
Location: Ultrabubble

Posted: 01/19/09 14:26 
Thanks for the lightening fast response Brian - I am at the end of my evening though so I will have to check this out in the morning, I am sure it will be the answers to several of my questions. Thankyou!!!


_________________
Kulshi Mezian!

"Stranger from another planet, welcome to our hole. Just strap on your guitar and we'll play some rock and roll"

Ultrabubble create things.
Back to top
Display posts from previous:   
User Support Forum Archive (Read Only)
Jamroom Developers

 
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.