SimplePortal

Support => English Support => Topic started by: immaturity on September 06, 2008, 12:27:35 PM

Title: anyone know how to do this?
Post by: immaturity on September 06, 2008, 12:27:35 PM
Right now I update our site's menu by hand, you can see at http://forum.parentalplayground.com

I will be installing simple portal next week-ish and working on my site a lot after that, and I am trying to figure out a way to do this...
1. Get the article categories and articles to be listed using the same kind of menu I already use on the left hand side. What it does it list the categories, and when you click on a category title it drops open to show the articles.

this is the script I currently use and update in my template whenever I have new content/articles: http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-bullet.htm

If someone can figure this out I'd love it! Like I said, I won't be starting my overhaul of the site for another week or so.
Title: Re: anyone know how to do this?
Post by: [SiNaN] on September 17, 2008, 09:28:23 AM
I liked the view and the idea. Will check this when I get home.
Title: Re: anyone know how to do this?
Post by: [SiNaN] on September 19, 2008, 04:14:05 AM
Okay, use this code in a php block:

Code: [Select]
global $db_prefix, $context, $user_info, $scripturl, $settings;

echo '
<script type="text/javascript" src="', $settings['theme_url'], '/jquery-1.2.2.pack.js"></script>

<script type="text/javascript" src="', $settings['theme_url'], '/ddaccordion.js">

/***********************************************
* Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

</script>


<script type="text/javascript">


ddaccordion.init({
headerclass: "expandable", //Shared CSS class name of headers group that are expandable
contentclass: "categoryitems", //Shared CSS class name of contents group
revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
animatedefault: false, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it\'s collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it\'s collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
animatespeed: "normal", //speed of animation: "fast", "normal", or "slow"
oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
//do nothing
},
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
//do nothing
}
})


</script>

<style type="text/css">

.arrowlistmenu{
width: 180px; /*width of accordion menu*/
}

.arrowlistmenu .menuheader{ /*CSS class for menu headers in general (expanding or not!)*/
font: bold 14px Arial;
color: white;
background: black url(', $settings['theme_images_url'], '/titlebar.png) repeat-x center left;
margin-bottom: 10px; /*bottom spacing between header and rest of content*/
text-transform: uppercase;
padding: 4px 0 4px 10px; /*header text is indented 10px*/
cursor: hand;
cursor: pointer;
}

.arrowlistmenu .openheader{ /*CSS class to apply to expandable header when it\'s expanded*/
background-image: url(', $settings['theme_images_url'], '/titlebar-active.png);
}

.arrowlistmenu ul{ /*CSS for UL of each sub menu*/
list-style-type: none;
margin: 0;
padding: 0;
margin-bottom: 8px; /*bottom spacing between each UL and rest of content*/
}

.arrowlistmenu ul li{
padding-bottom: 2px; /*bottom spacing between menu items*/
}

.arrowlistmenu ul li a{
color: #A70303;
background: url(', $settings['theme_images_url'], '/arrowbullet.png) no-repeat center left; /*custom bullet list image*/
display: block;
padding: 2px 0;
padding-left: 19px; /*link text is indented 19px*/
text-decoration: none;
font-weight: bold;
border-bottom: 1px solid #dadada;
font-size: 90%;
}

.arrowlistmenu ul li a:visited{
color: #A70303;
}

.arrowlistmenu ul li a:hover{ /*hover state CSS*/
color: #A70303;
background-color: #F3F3F3;
}

</style>';

$request = db_query("
SELECT ID_CATEGORY, name
FROM {$db_prefix}sp_categories
WHERE publish = 1
AND articles > 0
ORDER BY ID_CATEGORY", __FILE__, __LINE__);
$return = array();
while ($row = mysql_fetch_assoc($request))
{
$categories[] = array(
'id' => $row['ID_CATEGORY'],
'name' => $row['name'],
);
}
mysql_free_result($request);

foreach($categories as $key => $category)
{
$request = db_query("
SELECT m.subject, t.ID_TOPIC
FROM {$db_prefix}sp_articles AS a
LEFT JOIN {$db_prefix}messages AS m ON (m.ID_MSG = a.ID_MESSAGE)
LEFT JOIN {$db_prefix}topics AS t ON (t.ID_FIRST_MSG = a.ID_MESSAGE)
LEFT JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = m.ID_BOARD)
WHERE $user_info[query_see_board]
AND a.ID_CATEGORY = $category[id]
ORDER BY a.ID_MESSAGE DESC", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
{
$categories[$key]['articles'][] = '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['subject'] . '</a>';
}
mysql_free_result($request);
}

echo '
<div class="arrowlistmenu">';

foreach($categories as $category)
{
echo '
<h3 class="menuheader expandable">', $category['name'], '</h3>
<ul class="categoryitems">';

foreach($category['articles'] as $article)
echo '
<li>', $article, '</li>';

echo '
</ul>';
}

echo '
</div>';

Copy js files to default theme directory and images to default theme images directory.
Title: Re: anyone know how to do this?
Post by: Cyst on September 19, 2008, 04:45:17 AM
This is really interesting.
Have you guys ever thought about having an expandable box option for users? Or even something where users can display whichever boxes they want from a list and move them around to whichever positions they want - sort of like the Google custom pages.

That would certainly be something. I've seen the option for force block but I wasn't sure what that did... I assuse it's not the same thing.

I'd really love to have either of the two.
Title: Re: anyone know how to do this?
Post by: Nathaniel on September 19, 2008, 04:59:47 AM
That is a very interesting idea. The next version of Simple Portal has javascript collapsing for every block so your users can collapse them, it also has a 'Not Collapsable:' option which replaces the redundant 'Force Block:' setting.

We are trying to make the portal easier for you to customize, and easier for your users to customize if you allow them. One of the ideas tossed around, was a simple area for users to choose some blocks to be hidden from their 'Profile' pages, but we are open to other ideas. ;)
Title: Re: anyone know how to do this?
Post by: Cyst on September 19, 2008, 05:42:02 AM
The javascript collapsing option sounds great, can't wait to see that.

Letting users be able to remove or move blocks would be pretty cool. I know a few of my users asked for me to move certain blocks higher up the list of blocks, but the majority have wanted it to stay the same. It would rememdy that sort of thing :)

Of course some blocks would have to be locked in place... for example articles.
Title: Re: anyone know how to do this?
Post by: immaturity on September 29, 2008, 11:22:45 AM
thanks for the replies! I will try that java block and then come back to let everyone know how it works. probably not for a few more days.
;)
Title: Re: anyone know how to do this?
Post by: Nathaniel on November 13, 2008, 06:49:17 PM
Did you have any luck with it immaturity? Do you still require help?
Title: Re: anyone know how to do this?
Post by: immaturity on December 31, 2008, 04:43:12 PM
Sorry. I am FINALLY back with a working home computer. My hard drive got fried from a bad power cord shortly after my last post, so I was sharing my husband's computer until now.

So I never got a chance to test this. I finally got simple portal installed on the forum only to realize it doesn't have all of the features I need. :( I wanted to be able to create pages in addition to articles, and it looks like SP would be best for a less complicated site.

BUT THANK YOU SO VERY MUCH. I'll be keeping SP in mind for other projects for sure, it just doesn't have everything I need for the current project.
Title: Re: anyone know how to do this?
Post by: [SiNaN] on January 01, 2009, 07:30:33 AM
Thanks for using SimplePortal immaturity.
SimplePortal 2.3.8 © 2008-2024, SimplePortal