, Guest!
Already a Member? Login or Register.

Menu



Showcase


Due to the volume of spam happening on our forums, posting is now restricted to verified members only.  If you're not verified, drop us a note with your username.

Home > FlexCMS Support Forum > User Help > FAQ's: Templates > Tabbed Website

FlexCMS Support Forum


Tabbed Website
Started July 12, 2008 @ 9:45am by Grady
Post Message 
Grady


Posts: 25
 
Tabbed WebsiteJuly 12, 2008 @ 9:45am
Is there a way in php or javascript to create a tabbed website using FlexCMS? I want the tab to be highlighted on each page, but since the pages are built as displayed I was wondering how if at all you might indicate which page tab gets highlighted as you move from page to page.

Thank you
 
DCSun
Administrator



Posts: 625
 
July 12, 2008 @ 1:49pm
It is possible, but requires a bit of programming work. Essentially what you do is set up a series of IF statements to determine which page or group of pages is currently being viewed, and use that to build your menu block.

Here's a block of code that I've used on another site, it should get you started. There are really three sections to it, the first is the IF statements, which you'll need to adjust to suit your site. The second is the list of menu items, which you'll also need to adjust to match the top section. The third part is where it loops through the list above and prints the menu items based on whether it's the current page or not. In that example, the images are named menu_[ItemName].gif and menu_[ItemName]_sel.gif when selected.


Code

$ItemsSpacer = '<br>';

$ImagesPath = $ImagesURL.'/uploaded/';
$LinksPath = $MainURL.'/';

$ImagesPrefix = 'menu_';

$ItemsCount = 0;



if ($Arguments1 == 'pages' && ($Arguments2 == 'about_us')) {
$CurrentlySelectedNew['about'] = 1;
}
else if ($Arguments1 == 'articles') {
$CurrentlySelectedNew['articles'] = 1;
}
else if ($Arguments1 == 'pages' && ($Arguments2 == 'players_parents' || $Arguments2 == 'registration' || $Arguments2 == 'age_divisions' || $Arguments2 == 'schedules' || $Arguments2 == 'arena_locations')) {
$CurrentlySelectedNew['players'] = 1;
}
else if ($Arguments1 == 'photos') {
$CurrentlySelectedNew['photos'] = 1;
}
else if ($Arguments1 == 'pages' && $Arguments2 == 'merchandise') {
$CurrentlySelectedNew['merchandise'] = 1;
}
else if ($Arguments1 == 'links') {
$CurrentlySelectedNew['links'] = 1;
}



$ItemsCount++;
$ItemLinks[$ItemsCount] = 'pages/about_us.html';
$ItemName[$ItemsCount] = 'about';
$ItemAltText[$ItemsCount] = 'About Us';

$ItemsCount++;
$ItemLinks[$ItemsCount] = 'articles.html';
$ItemName[$ItemsCount] = 'articles';
$ItemAltText[$ItemsCount] = 'News & Events';

$ItemsCount++;
$ItemLinks[$ItemsCount] = 'pages/players_parents.html';
$ItemName[$ItemsCount] = 'players';
$ItemAltText[$ItemsCount] = 'Players & Parents';

$ItemsCount++;
$ItemLinks[$ItemsCount] = 'photos.html';
$ItemName[$ItemsCount] = 'photos';
$ItemAltText[$ItemsCount] = 'Photo Gallery';

$ItemsCount++;
$ItemLinks[$ItemsCount] = 'pages/merchandise.html';
$ItemName[$ItemsCount] = 'merchandise';
$ItemAltText[$ItemsCount] = 'Merchandise';

$ItemsCount++;
$ItemLinks[$ItemsCount] = 'links.html';
$ItemName[$ItemsCount] = 'links';
$ItemAltText[$ItemsCount] = 'Links & Resources';




for ($i = 1; $i <= $ItemsCount; $i++) {

if ($i != 1) {
print $ItemsSpacer;
}

if ($CurrentlySelectedNew[$ItemName[$i]]) {
print '<A HREF="'.$LinksPath.$ItemLinks[$i].'"><IMG BORDER="0" SRC="'.$ImagesPath.$ImagesPrefix.$ItemName[$i].'_sel.gif" alt="'.$ItemAltText[$i].'" title="'.$ItemAltText[$i].'"></A>';
}
else {
print '<A HREF="'.$LinksPath.$ItemLinks[$i].'"><IMG BORDER="0" SRC="'.$ImagesPath.$ImagesPrefix.$ItemName[$i].'.gif" alt="'.$ItemAltText[$i].'" title="'.$ItemAltText[$i].'"></A>';
}

}

Paste or include that into a PHP enabled block.



David


FlexCMS v3.2 Has Been Released!
 

Last Edit: July 12, 2008 @ 1:49pm by DCSun

Post Message 




Try & Buy FeedForAll - Easy to use RSS Feed Creator - great for iTunes users!

MEMBERS




All Contents, Code, Scripts and Technologies Copyright 2003-2009 FlexCMS.
All Rights Reserved. Software License Agreement

Processing Time: 0.09375 seconds.
 
Management Login

Powered By FlexCMS
Powered By FlexCMS