Yii Framework Forum: CTabView with no tabs open initially - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CTabView with no tabs open initially

#1 User is offline   Maxximus 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 146
  • Joined: 24-November 08
  • Location:Spain

Posted 15 December 2008 - 07:51 PM

For a project I'm converting I needed a tabbed view with all tabs closed initially. CTabView doesn't like that, but I wanted to use the build-in version. For that reason I extended CTabview with an additional control: noTab.


class MyTabView extends CTabView
{
public $noTab = false;

protected function renderHeader()
{
if ($this->noTab === true)
$this->activeTab='';

echo "<ul>n";
foreach($this->tabs as $id=>$tab)
{
$title=isset($tab['title'])?$tab['title']:'undefined';
$active=$id===$this->activeTab?' class="active"' : '';
$url=isset($tab['url'])?$tab['url']:"#{$id}";
echo "<li><a href="{$url}"{$active}><span>{$title}</span></a></li>n";
}
echo "</ul>n";
}
}

The Title is not urlencoded anymore, so it will accept HTML too, that way you can add some nice thumbnail image besides your title.
-edit- There was some CSS here... Looked nice in FF, but IE ahem, well @#$^@#$!

Attached File(s)

  • Attached File  tab.png (734bytes)
    Number of downloads: 34

0

#2 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 707
  • Joined: 29-November 08
  • Location:Paris, France

Posted 16 December 2008 - 04:41 AM

Hi Maxximus,
I've already entered an issue (43) related to the CTabView display under IE6. Are you using IE6 ?
8)
0

#3 User is offline   Maxximus 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 146
  • Joined: 24-November 08
  • Location:Spain

Posted 16 December 2008 - 06:53 PM

Hi, Yeah, tested eventually with IE6 and it broke. But the reason was also that I adapted the CSS to use the PNG tab from the official JQuery tabs plugin. looked really nice in FF but IE is spoiling the fun again.

By the way, I thought YiiTabs was the official JQuery tabs, but it isn't. This one is quite limited unfortunately.
0

#4 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 707
  • Joined: 29-November 08
  • Location:Paris, France

Posted 17 December 2008 - 05:48 AM

One problem is that IE6 does not support the '>' child selector, so if you just remove them from the Tab CSS, the layout is better ... but not yet 100% ok.
(I've encountered the same kind of issue with the yii Tree widget).
I've created an issue for this
8)
0

#5 User is offline   megabr 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 142
  • Joined: 23-March 09
  • Location:Brazil

Posted 24 April 2009 - 03:31 PM

CTabView: how to start with especific tab??

ini()? where?
0

#6 User is offline   megabr 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 142
  • Joined: 23-March 09
  • Location:Brazil

Posted 24 April 2009 - 03:55 PM

solution: $tab='tab2'


0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users