Hi,

I would like to add specific views blocks, like "New Forum Topics" and "Active Forum Topics" to my JQuery Accordion menu.

This is the code I have for the JQuery accordion menu:



   1.
      <html xmlns="http://www.w3.org/1999/xhtml">
   2.
      <head>
   3.
       
   4.
      <style type="text/css">
   5.
       
   6.
      .msg_list {
   7.
              list-style: none;
   8.
              margin: 0;
   9.
              padding: 0;
  10.
              width: 180px;
  11.
      }
  12.
      .msg_head {
  13.
      color: #ffffff;
  14.
              padding: 0px 10px;
  15.
              cursor: pointer;
  16.
              position: relative;
  17.
              background-color:#000000;
  18.
              margin:1px;
  19.
      }
  20.
      .msg_body {
  21.
              padding: 5px 10px 15px;
  22.
              background-color:#F4F4F8;
  23.
      }
  24.
      </style>
  25.
      </head>
  26.
      <body>
  27.
      <script type="text/javascript" src="jquery.js"></script>
  28.
      <script type="text/javascript">
  29.
      <!--//---------------------------------+
  30.
      //  Developed by Roshan Bhattarai
  31.
      //  Visit http://roshanbh.com.np for this script and more.
  32.
      //  This notice MUST stay intact for legal use
  33.
      // --------------------------------->
  34.
      $(document).ready(function()
  35.
      {
  36.
              //hide the all of the element with class msg_body
  37.
              $(".msg_body").hide();
  38.
              //slides the element with class "msg_body" when paragraph with class "msg_head" is clicked
  39.
              $("#firstpane p.msg_head").click(function()
  40.
          {
  41.
                      $(this).next("div.msg_body").slideToggle(700).siblings("div.msg_body").slideUp("slow");
  42.
              });
  43.
              //slides the element with class "msg_body" when mouse is over the paragraph
  44.
              $("#secondpane p.msg_head").mouseover(function()
  45.
          {
  46.
                   $(this).next("div.msg_body").slideDown("slow").siblings("div.msg_body").slideUp("slow");
  47.
              });
  48.
      });
  49.
      </script>
  50.
      <div style="float:left; margin-left:0px;"> <!--This is the second division of right-->
  51.
       
  52.
        <div class="msg_list" id="secondpane">
  53.
                      <p class="msg_head">Current Areas Covered</p>
  54.
                      <div class="msg_body">
  55.
                              TESTTTTTTTTTTTTTTTTTTTTTTTTTTTT
  56.
                      </div>
  57.
                      <p class="msg_head">Today's Events</p>
  58.
                      <div class="msg_body">
  59.
                              orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
  60.
                      </div>
  61.
       
  62.
                      <p class="msg_head">New Spots For Rent</p>
  63.
                      <div class="msg_body">
  64.
                              TESTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT     
  65.
      </div>
  66.
                      <p class="msg_head">New Forum Topics</p>
  67.
                      <div class="msg_body">
  68.
                              orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
  69.
                      </div>
  70.
                     
  71.
                      <p class="msg_head">Active Forum Topics</p>
  72.
                      <div class="msg_body">
  73.
                              orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
  74.
                      </div>
  75.
                     
  76.
              </div>
  77.
      </div>
  78.
      </body>
  79.
      </html>

Am I supposed to add a function like one of these get views functions? --> http://drupalcontrib.org/api/function/views_get_view/6 or http://drupalcontrib.org/api/function/views_block/6

Can someone tell me what code I would need to add to do this?

Thanks!

Comments

Chris Einkauf’s picture

If I were you, I'd use the View Accordion module. You can then set the style of your view to "views accordian" within the Views UI. You could then put the following code on the page you want your view appearing on (or, in my case, I put the code into a specific content type's node-MYCONTENTTYPE.tpl.php):

$view1 = views_get_view('browse_media','default'); //(browse_media is the name of my view and I'm just using the default display)
$view1->override_path = $_GET['q'];
$viewsoutput1 = $view1->preview();

print $viewsoutput1;