Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Show modules on all sub menu items + floating hack

Show modules on all sub menu items + floating hack

I use this hack in my index.php joomla template. This hack makes the search module scroll on my jReviews categories: dev.kesselfieber.de/stuttgart-erkunden/clubs
But I'd like to use this hack on all jReviews listing items too. Of course I don't want to write every single ItemID into the index.php wink

Question: How can I use this hack on all items of jReviews?

Code:

<?php   if($_REQUEST['Itemid'] == '186' || $_REQUEST['Itemid'] == '183' || $_REQUEST['Itemid'] == '220' || $_REQUEST['Itemid'] == '213' || $_REQUEST['Itemid'] == '211' ) : ?>

<script type="text/javascript">
jQuery(function($) {

  var msie6 = $.browser == 'msie' && $.browser.version < 7;

  if (!msie6) {
    var top = $('#rt-sidebar-a').offset().top - parseFloat($('#rt-sidebar-a').css('margin-top').replace(/auto/, 0));
    $(window).scroll(function (event) {
      // what the y position of the scroll is
      var y = $(this).scrollTop();
     
      // whether that's below the form
      if (y >= top) {
        // if so, ad the fixed class
        $('.scroll').addClass('fixed');
      } else {
        // otherwise remove it
        $('.scroll').removeClass('fixed');
      }
    });
  } 
});
</script>
<style>
#rt-sidebar-a{
  left: 0px;
  position: absolute;
  margin:0 0 0 0px;
  width:300px !important;
}
.scroll {
  position: absolute;
  top: 0;
  width:300px !important;

}
#rt-sidebar-a .fixed {
  position: fixed;
  top: 0;
}

</style>

I'm not a coder but a designer. So I don't know how to achieve that.

Thank you in advance for every answer!
getimo

Edited By: getimo
01-Mar-11 14:38:32

getimo
Beginner Modder
ranks
useravatar
Offline
17 Posts
Administrator has disabled public posting

Re: Show modules on all sub menu items + floating hack

Hi Getimo,

The thing with JReviews items is that as far as I can see, it affects ALL articles in the categories that are controlled by JReviews.

So you should be able to use the JomGenius rules for detecting categories, and just detect anything inside the relevant categories.

e.g. if you are inside a MetaMod you can do this:

if ( $content_genius->check( "category_id = 123, 456, 789") ) {
  ... stuff here ...
}

(that assumes of course that 123, 456 and 789 are categories controlled by JReviews).

I hope that helps,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: Show modules on all sub menu items + floating hack

Hi, thank you very much for your answer. I understand what you say but I don't know how to write it in metamod.

- Where do I write the CSS?
- Where do I write the jQuery Script?
- How do I load the module(s)?

TO many questions for me smile I hope you can explain or provide some sample code which I can extend. Sorry but I'm a designer not a coder :-/

Kind Regards
getimo

getimo
Beginner Modder
ranks
useravatar
Offline
17 Posts
Administrator has disabled public posting

Re: Show modules on all sub menu items + floating hack

Hi Getimo,

I think I would put the CSS into the normal CSS file of your template.

For the Javascript you could put this inside a MetaMod, basically just using the MetaMod as a way to run some PHP code and put the javascript onto the page. You probably don't need it to actually insert the target modules.

So you could do something like this:


if ( $content_genius->check( "category_id = 123, 456, 789") ) {
?>
<script type="text/javascript">
jQuery(function($) {
  var msie6 = $.browser == 'msie' && $.browser.version < 7;
  if (!msie6) {
    var top = $('#rt-sidebar-a').offset().top - parseFloat($('#rt-sidebar-a').css('margin-top').replace(/auto/, 0));
    $(window).scroll(function (event) {
      // what the y position of the scroll is
      var y = $(this).scrollTop();
      // whether that's below the form
      if (y >= top) {
        // if so, ad the fixed class
        $('.scroll').addClass('fixed');
      } else {
        // otherwise remove it
        $('.scroll').removeClass('fixed');
      }
    });
  } 
});
</script><?php



I think that should work... you might want to put this into a module position at the very bottom of the page (rather than in a left or right column) just in case it reserves horizontal space for an otherwise empty module.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1696
Total Polls:
6
Total Posts:
5941
Total Posts Today:
7
User Info:
 
Total Users:
5366
Newest User:
angelo3455
Members Online:
0
Guests Online:
179

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked