Jamroom Logo Jamroom 5 Core
is now Open Source!
User Support Forum Archive (Read Only)
Jamroom Developers:
module. attach a css file in the headers.
Michael
Jamroom Team


Joined: 22 Apr 2008
Posts: 3423
Location: Tokyo

Posted: 01/14/09 19:10 
Is there any way to attach a css file from the module construction so that it gets output into the header section of the html?


_________________
Michael Ussher
Jamroom Network Team Member: http://www.jamroom.net
Priority Support: http://www.jamroom.net/Support_Center
Back to top
Brian
Jamroom Team


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

Posted: 01/14/09 19:13 

ussher:
Is there any way to attach a css file from the module construction so that it gets output into the header section of the html?


Can you link to the CSS file? I'm not quite sure what you mean..

Hope this helps!

- Brian


_________________
Make sure and check out:
* The Jamroom FAQ
* The Jamroom Documentation
Back to top
Michael
Jamroom Team


Joined: 22 Apr 2008
Posts: 3423
Location: Tokyo

Posted: 01/14/09 19:29 

Code
   // Set up our page
   jmHtmlBegin('the module name');   
   jmBodyBegin();   
   //draw the heading title on the page
   jmSpanCell("{$config['system_name']} module name", "module explaniation", 30, 'html_select_modify.png');
   print '<link rel="stylesheet" type="text/css" href="module/module_name/css/style.css">';



i want to get the style sheet link into the <head></head> section.

is there a way to do that? since the head section is usually governed by the template in the skins or themes.


_________________
Michael Ussher
Jamroom Network Team Member: http://www.jamroom.net
Priority Support: http://www.jamroom.net/Support_Center
Back to top
smith.kyle
CodeSmith


Joined: 27 Apr 2006
Posts: 22009
Location: Southern California

Posted: 01/14/09 19:38 
You used to be able to do it with the jmHtmlBegin function:

http://www.jamroom.net/Function_jmHtmlBegin

The function definition looks a little funky though, so I'm not sure


_________________
kyle[at]jamroom.net

Yes...that's a soda machine...

I get bored when no one's posting...
Back to top
Michael
Jamroom Team


Joined: 22 Apr 2008
Posts: 3423
Location: Tokyo

Posted: 01/14/09 20:24 
Embarassed RTFM

Thanks Kyle that worked perfectly. sorry.


_________________
Michael Ussher
Jamroom Network Team Member: http://www.jamroom.net
Priority Support: http://www.jamroom.net/Support_Center
Back to top
Brian
Jamroom Team


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

Posted: 01/14/09 20:34 
Actually the PHP doc for that function looks messed up - let me see if I can fix it up.

- Brian


_________________
Make sure and check out:
* The Jamroom FAQ
* The Jamroom Documentation
Back to top
Brian
Jamroom Team


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

Posted: 01/14/09 20:35 
Currently the function doesn't support extra CSS files being included, but I'll see if that is an easy add.

Hope this helps!

- Brian


_________________
Make sure and check out:
* The Jamroom FAQ
* The Jamroom Documentation
Back to top
Michael
Jamroom Team


Joined: 22 Apr 2008
Posts: 3423
Location: Tokyo

Posted: 01/14/09 22:23 
it seamed to work ok with this:

Code
// Set up our page
   jmHtmlBegin('module name','<link rel="stylesheet" type="text/css" href="modules/module_name/css/style.css">');   


the line i wanted appeared where i wanted it.


_________________
Michael Ussher
Jamroom Network Team Member: http://www.jamroom.net
Priority Support: http://www.jamroom.net/Support_Center
Back to top
SteveX
Ultrabubble


Joined: 30 Aug 2005
Posts: 8792
Location: Ultrabubble

Posted: 01/15/09 00:26 
There is also the output filter and block.head way, which Brian coded into 3.3.8, but I have jsut tried it on 4.0 and no luck. Are the output filters still working in 4?


bigguy:
I've just uploaded an updated 3.3.8 testing changed files package that adds support for pre, post and output smarty filters. How it works is that you place your defined filters into a "filter" file that is named the same as the template - i.e.

jamroom/skins/Skin_Name/sometemplate.tpl
jamroom/skins/Skin_Name/sometemplate.tpl.filter

The contents of the filter file must be like:

FILTER_TYPE:filter_name

i.e.


Code

output:move_to_head


This means the "smarty_outputfilter_move_to_head.php" file MUST be in the jamroom/include/plugins/smarty directory.

You can "stack" up pre/post/output filters in the file to if you want - i.e.:


Code

pre:some_pre_filter
pre:another_pre_filter
post:some_post_filter
output:some_output_filter
output:another_output_filter


Note that only "pre", "post" and "output" are valid values for the FILTER_TYPE.

If you can download it and check it out and let me know if it works for you, that would be great.

Hope this helps!

- Brian


http://smarty.incutio.com/?page=BlockHeadPlugin

http://www.jamroom.net/phpBB2/viewtopic.php?t=19551&highlight=outputfilter

block.jr_head.php:

Code
<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */

/**
 * Smarty {head} block plugin
 *
 * Filename: block_head.php<br>
 * Type:     block<br>
 * Name:     head<br>
 * Date:     April 28, 2006<br>
 * Purpose:  move all content in headblocks to the header of the html document
 *
 * Examples:<br>
 * <pre>
 * {head}
 *    <style type="text/css">
 *       h1{font-family:fantasy;}
 *    </style>
 * {/head}
 * </pre>
 * @author Mathias Baert <mathias@motionmill.com>
 * @version  0.1
 * @param array
 * @param string
 * @param Smarty
 * @param boolean
 * @return string
 */
function smarty_block_jr_head($params, $content, &$smarty, &$repeat){
    if ( empty($content) ) {
        return;
    }
    return '@@@SMARTY:HEAD:BEGIN@@@'.trim($content).'@@@SMARTY:HEAD:END@@@';
}

?>


outputfilter.move_to_head.php:

Code
<?php
/**
* outputfilter adds content of {head}-blocks to document<head>
* @param string
* @param Smarty
* @return string
*/
function smarty_outputfilter_move_to_head($tpl_output, &$smarty)
{
    $matches = array();
    preg_match_all('!@@@SMARTY:HEAD:BEGIN@@@(.*?)@@@SMARTY:HEAD:END@@@!is', $tpl_output, $matches);
    $tpl_output = preg_replace("!@@@SMARTY:HEAD:BEGIN@@@(.*?)@@@SMARTY:HEAD:END@@@!is", '', $tpl_output);
    return str_replace('</head>', implode("\n", array_unique($matches[1]))."\n".'</head>', $tpl_output);
}
?>



_________________
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/16/09 14:56 
This should be working - I just checked the code out and it all looks correct - are you seeing any errors or does it just not appear to work? Double check that you're not seeing a cached page.

Thanks!

- 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/16/09 15:17 
Doh! My mistake (a typo Embarassed ). This is all still working perfectly (of course).


_________________
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/16/09 15:19 

SteveX:
Doh! My mistake (a typo Embarassed ). This is all still working perfectly (of course).


Glad to hear it - thanks!

- 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/16/09 15:52 
This really does work perfectly with the Module setup.

Note that the example above needs to be used like this:

Code
{jr_head} code to appear before </head> tag{/jr_head}


However, you are not limited to inserting things into the head right before the head tag, you can duplicate the plugin as uj_generator and have it appear before the generator tag, or change the regex a little more and insert keywords into keywords tag. All in all a very useful way of inserting your module code into Jamroom's in a not-very-intrusive way.

I guess your module will need to have the functions and filters uploaded to the include directory, but I haven't tried this yet so perhaps it will work in the smarty directory of the module, I am not certain.


_________________
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
Michael
Jamroom Team


Joined: 22 Apr 2008
Posts: 3423
Location: Tokyo

Posted: 01/16/09 18:56 
I haven't yet come across the way to use smarty templates for layout in my module building exercises yet.

Is that how were supposed to do it? I've just been using php to construct the layout mixing all that logic and layout together in a big spaghetti ball.

It would be nice to do separate it, but i haven't got to that page in the manual yet.


_________________
Michael Ussher
Jamroom Network Team Member: http://www.jamroom.net
Priority Support: http://www.jamroom.net/Support_Center
Back to top
SteveX
Ultrabubble


Joined: 30 Aug 2005
Posts: 8792
Location: Ultrabubble

Posted: 01/17/09 03:00 
The process function at the bottom of the jrYouTube.php file in the module's ranking directory shows how to use jrHtmlTemplate for ranking output using a template.

I have been using this just to call a single (non-ranking) template into a smarty function as well. You can add anything to the $_rep array and it will be available as a smarty variable in the template.


_________________
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.