You are not logged in.
Pages: 1
Hi Tim/Bigtree team. Would you happen to have an Areas of Study / Majors / Minors / Departments extension for a higher education website available to share? I've been working on my own solution for a couple of days, and the more I think about all of the features I'd like to include, the more time intensive this project is becoming. Even if I had a rough framework to work with, that would save a bunch of work on my end. It's a long shot I'm sure, but I figured I'd at least ask Thanks.
Offline
We usually do a custom setup each time depending on the client's needs. Some of them use Acalog to power the majors / minors / departments, some don't. Some of them have strict subpages for each department so we power all those subpages via a single routed template that grabs everything from modules. Other clients want to let their departments go wild adding subpages so we have to do trickier things like having a department resource in the "department landing" template that correlates to a module entry and then we have to read the page tree for subpages (if we want to somehow relate the subpages to the department they're under).
If you let me know your needs I can let you know if we have anything we could export that might be helpful!
Offline
Thanks Tim. Yeah, unfortunately we don't have a catalog management system, so we would probably have to do the static page/elaborate method. Catalog management is definitely on my wishlist. Our organization has been looking at Courseleaf, but who knows if and when that will happen. I haven't heard of Acalog, so I'd be curious to learn more about it. Essentially what we will be doing is using a departmental organization structure in an Areas of Study section of the website, similar to below:
Anthropology
Faculty
Degrees/certificates/special programs
Courses/requirements
Contact information
...
Art
Faculty
Degrees/certificates/special programs
Courses/requirements
Contact information
...
Biology
Faculty
Degrees/certificates/special programs
Courses/requirements
Contact information
...
Business
...
Chemistry
...
Communication
...
Corrections
...
We would like to include faculty members, degrees/certificates/special programs, contact information, description, degree requirements, etc. within each of these department sections. I've already set up a module that allows entry for most, if not all of the "departments", but when I start thinking of ways to organize all of the other information underneath the department level, within a module, realizing that much of this will also need to be reflected in some kind of menu system, which is ideally part of the same menu structure as the rest of the website, things get a little shaky. Relating templates, modules, and menus is something I've been wrestling with in Bigtree, even in other sections of the website. Any recommendations, or sample code is very much appreciated. I think I'm on the right track, but always open to ideas for best practices.
Offline
Let me give this some thought and I'll get back to you tomorrow, hopefully with a small package you can install and try out and see if it helps!
Offline
Sounds great! Thanks.
Offline
Ok, I've put together an example of how I would personally tie them together, though it's not the most flexible system. Every department page automatically gets Faculty / Programs / Contact Info subpages through the Departments class's getNav method. Those pages all get populated through different routes of the Departments template.
I didn't complete the routing and build out a course listing or course detail page, but hopefully it's enough to spark your imagination on ways that you could go about building it
Offline
Oh, this is amazing. Thank you very much. Can't wait for you to see the site when we are done.
Offline
We're definitely excited to see it! Always happy to add new sites to the homepage
Offline
Everything is going great with the areas of study module. Something is weird in the way it's adding the Faculty/Degrees & Programs/Contact Information sub-pages to the menu though. At least with the code I am using to parse the menu array, which is admittedly quite a hack job. For some reason every sub section under the department pages is printing out pages from the parent menu as children, as shown below in the {{{...}}}.
Admissions & Aid
Academics
Academic Calendar
Academic Resources
Areas of Study
Science
Faculty
{{{Academics}}}
Degrees & Programs
{{{Academics}}}
Contact Information
{{{Academics}}}
Distance Education
Library
Special Programs
2015 Course Catalog
Student Life
About
Click on any of the Faculty/Degrees & Programs/Contact Information pages reveals the top level menu:
Faculty
Admissions & Aid
Academics
Student Life
About
I'm guessing is has something to do with the getnav function in the custom > inc > modules > departments.php, but I don't know enough about what that's doing to brainstorm it.
function getNav($page) {
$base_link = WWW_ROOT.$page["path"]."/";
return array(
array("title" => "Faculty", "link" => $base_link."faculty/"),
array("title" => "Degrees & Programs", "link" => $base_link."programs/"),
array("title" => "Contact Information", "link" => $base_link."contact/")
);
}
Offline
In case you're wondering, below is the aforementioned hack job. Basically, I wanted to recursively continue drawing out sub-pages, and subs of those, and so on - but, always maintain the top level ancestor in the menu, instead of moving one level deeper into the menu each time I clicked a sub page (I always want the top level ancestor to be at the top of the menu, no matter how deep into it I get). Also, I wanted to be able to add a specific class to each level (i.e. top, second, third, forth, etc.). I'm sure there is a MUCH better and more efficient way to do this, but I played with it quite a bit, and this is the best I could come up with at the time. I'm by no means a PHP master, but I'm trying to get by.
Oddly enough, I did try reverting back to a standard sub-navigation loop, shared at https://gist.github.com/bigtreecms/5205661, just to see if that might change things, and it didn't even draw out the faculty, programs, or contact information at all. I see the departments listed, but nothing below that.
ADAPTED SUBNAVIGATION LOOP
-------------------------------------------------------------------------
<?
$currentURL = BigTree::currentURL();
$parent = $cms->getPage($page["parent"]);
while ($parent["id"] > 0) {
$ancestor = $cms->getPage($parent["parent"]);
if ($ancestor > 0 && $ancestor > 4) {
$parent = $ancestor;
}
}
$subnav = $cms->getNavByParent($parent["id"], 2);
?>
<?
if ((count($subnav)) > 0) {
?>
<nav class="subnavigation">
<div class="naver-handle">Additional Navigation</div>
<div class="naver-wrapper">
<div class="naver-container">
<? foreach ($subnav as $item) { ?>
<?
$isActive = $currentURL == $item["link"];
$isOpen = (strpos($currentURL, $item["link"]) > -1);
$hasChildren = (count($item["children"]) > 0);
?>
<div class="top item<? if ($isActive || $isOpen) { echo ' active'; } else { echo ' inactive'; } ?><? if ($hasChildren) echo ' parent'; ?>">
<a href="<?=$item["link"]?>" class="<? if ($isOpen) echo ' open'; ?><? if ($isActive) { echo ' active'; } else { echo ' inactive'; } ?>"> <span></span><?=$item["title"]?></a>
<? $subnav2 = $cms->getNavByParent($item["id"], 2); ?>
<?
if (count($subnav2 > 0)) {
?>
<? foreach ($subnav2 as $item2) { ?>
<?
$isActive = $currentURL == $item2["link"];
$isOpen = (strpos($currentURL, $item2["link"]) > -1);
$hasChildren = (count($item2["children"]) > 0);
?>
<div class="second children item<? if ($isActive || $isOpen) { echo ' active'; } else { echo ' inactive'; } ?><? if ($hasChildren) echo ' parent'; ?>">
<a href="<?=$item2["link"]?>" class="<? if ($isOpen) echo ' open'; ?><? if ($isActive) { echo ' active'; } else { echo ' inactive'; } ?>"> <span></span><?=$item2["title"]?></a>
<? $subnav3 = $cms->getNavByParent($item2["id"], 2); ?>
<?
if (count($subnav3 > 0)) {
?>
<? foreach ($subnav3 as $item3) { ?>
<?
$isActive = $currentURL == $item3["link"];
$isOpen = (strpos($currentURL, $item3["link"]) > -1);
$hasChildren = (count($item3["children"]) > 0);
?>
<div class="third children item<? if ($isActive || $isOpen) { echo ' active'; } else { echo ' inactive'; } ?><? if ($hasChildren) echo ' parent'; ?>">
<a href="<?=$item3["link"]?>" class="<? if ($isOpen) echo ' open'; ?><? if ($isActive) { echo ' active'; } else { echo ' inactive'; } ?>"> <span></span><?=$item3["title"]?></a>
<? $subnav4 = $cms->getNavByParent($item3["id"], 2); ?>
<?
if (count($subnav4 > 0)) {
?>
<? foreach ($subnav4 as $item4) { ?>
<?
$isActive = $currentURL == $item4["link"];
$isOpen = (strpos($currentURL, $item4["link"]) > -1);
$hasChildren = (count($item4["children"]) > 0);
?>
<div class="forth children item<? if ($isActive || $isOpen) { echo ' active'; } else { echo ' inactive'; } ?><? if ($hasChildren) echo ' parent'; ?>">
<a href="<?=$item4["link"]?>" class="<? if ($isOpen) echo ' open'; ?><? if ($isActive) { echo ' active'; } else { echo ' inactive'; } ?>"> <span></span><?=$item4["title"]?></a>
<? $subnav5 = $cms->getNavByParent($item4["id"], 2); ?>
<?
if (count($subnav5 > 0)) {
?>
<? foreach ($subnav5 as $item5) { ?>
<?
$isActive = $currentURL == $item5["link"];
$isOpen = (strpos($currentURL, $item5["link"]) > -1);
$hasChildren = (count($item5["children"]) > 0);
?>
<div class="fifth children item<? if ($isActive || $isOpen) { echo ' active'; } else { echo ' inactive'; } ?><? if ($hasChildren) echo ' parent'; ?>"> <a href="<?=$item5["link"]?>" class="<? if ($isOpen) echo ' open'; ?><? if ($isActive) { echo ' active'; } else { echo ' inactive'; } ?>"> <span></span><?=$item5["title"]?></a></div>
<? } ?>
<? } ?>
</div>
<? } ?>
<? } ?>
</div>
<? } ?>
<? } ?>
</div>
<? } ?>
<? } ?>
</div>
<? } ?>
</div>
</div>
</nav>
<?
}
?>
Last edited by jesse.glaves (December 6, 2014 6:26pm)
Offline
Ok, I think I figured it out. These faculty, degrees/programs, and contact info. pages which are being dynamically inserted into the menu do not have id's. The code is looking for id's to figure out where inside of the menu array the item lives. Since they didn't have id's it was getting confused. I just added some code to check that the current item has an ID before trying to write out its children menus. If not, it just stops recursing.
if (count($subnav2 > 0)) { }
if (count($subnav2 > 0) && isset($item["id"])) { }
Offline
Glad you figured it out! I'm out of the office on vacation so I have limited programming bandwidth while keeping the family happy for the next week, but I'll be sure to catch up with any questions when I return
Offline
Pages: 1