Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 06:55 pm EDT

Geeklog Forums

Tabbed blocks

Page navigation


Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
Well, COM_olderstuff is the function, but it does not return anything.
So I made an identical function with a return at the bottom, and it works. You might want to add it to your lib-custom
Text Formatted Code
function TEST_olderStuff()
{
    global $_TABLES, $_CONF;

    $sql = "SELECT sid,tid,title,comments,UNIX_TIMESTAMP(date) AS day FROM {$_TABLES['stories']} WHERE (perm_anon = 2) AND (date <= NOW()) AND (draft_flag = 0)" . COM_getTopicSQL( 'AND', 1 ) . " ORDER BY featured DESC, date DESC LIMIT {$_CONF['limitnews']}, {$_CONF['limitnews']}";
    $result = DB_query( $sql );
    $nrows = DB_numRows( $result );

    if( $nrows > 0 )
    {
        $dateonly = $_CONF['dateonly'];
        if( empty( $dateonly ))
        {
            $dateonly = '%d-%b'; // fallback: day - abbrev. month name
        }

        $day = 'noday';
        $string = '';

        for( $i = 0; $i < $nrows; $i++ )
        {
            $A = DB_fetchArray( $result );

            $daycheck = strftime( '%A', $A['day'] );
            if( $day != $daycheck )
            {
                if( $day != 'noday' )
                {
                    $daylist = COM_makeList( $oldnews, 'list-older-stories' );
                    $daylist = preg_replace( "/(1512)|(15)|(12)/",
                                             '', $daylist );
                    $string .= $daylist . '<br>';
                }

                $day2 = strftime( $dateonly, $A['day'] );
                $string .= '<b>' . $daycheck . '</b> <small>' . $day2
                        . '</small>' . LB;
                $oldnews = array();
                $day = $daycheck;
            }

            $oldnews[] = '<a href="' . COM_buildUrl( $_CONF['site_url']
                . '/article.php?story=' . $A['sid'] ) . '">' . $A['title']
                . '</a> (' . $A['comments'] . ')';
        }

        if( !empty( $oldnews ))
        {
            $daylist = COM_makeList( $oldnews, 'list-older-stories' );
            $daylist = preg_replace( "/(1512)|(15)|(12)/", '', $daylist );
            $string .= $daylist;
            $string = addslashes( $string );

            DB_query( "UPDATE {$_TABLES['blocks']} SET content = '$string' WHERE name = 'older_stories'" );
        }
    }
return $string;
}
 

There might be a better way of doing this. Dirk would know better.
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 05/27/03
Posts: 612
As long as it works I'm good with it, and it does. I'll probably remove the word TEST tho.

Also I changed the buttons a bit but I'm not a very good graphic artist so they are a little cheesey.

Thanks, good job.

Ron
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 05/27/03
Posts: 612
I changed TEST to TABS.
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
You must have your tabbed blocks hidden to the public, I can't find them.

Also you still have the javascript error on your pages from calling the js functions onload. This can be easily fixed by calling the function initJavaScript from the block itself.

If you would like me to design your tab images I'd be happy to. Or you could get rid of the images all together and just use bgcolor and border changes instead. Some great css tutorials can be found here.

Have fun!
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 05/27/03
Posts: 612
Actually on that site I broke it so bad I had to go back to the original version. So now I'm testing the new version here on my testing site.

The old code is test and the new code is test2. I changed the function to phpblock_tabs2 just for testing purposes so both can be up and running.

It seems to be working except now I'm trying to get the middle seperator to work so that it will have the two rows of tabs with a title between.
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
Well, it looks like you need to either put a br after the members div and the tabtitle div Or makeup a class for tabtitle and give it a span of 100% and maybe a different bgcolor for it too.
I think you will like the newer code better as it is more cross browser compatible, and streamlined.

Cheers
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
Hey Ron, I fixed your layout problem,
add this to your stylesheet:
Text Formatted Code
#tabtitle  { color: #000000; font-size: 7pt; font-family: verdana; font-weight: bold; background: #ffffff; text-align: center; cursor: pointer; display: table-cell; padding: 0; width: 150px; height: 15px; float: left; vertical-align: middle; border-bottom: none }
 

and this is how your tab layout would look:
Text Formatted Code
<div id='main1' class='block_tabs'>
<div id='tabtitle'>Who's Online</div>
<div onclick="getTabStuff('20','mainHolder','main', '1')" class='tab1' id='tab_20'>Now</div>
<div onclick="getTabStuff('21','mainHolder','main', '1')" class='tab1' id='tab_21'>New</div>
<div onclick="getTabStuff('22','mainHolder','main', '1')" class='tab1' id='tab_22'>Members</div>
<div id='tabtitle'>Articles</div>
<div onclick="getTabStuff('23','mainHolder','main', '1')" class='tab1' id='tab_23'>New</div>
<div onclick="getTabStuff('24','mainHolder','main', '1')" class='tab1' id='tab_24'>Old</div>
<div onclick="getTabStuff('25','mainHolder','main', '1')" class='tab1' id='tab_25'><a href='{$_CONF['site_url']}/submit.php'>Submit</a></div>
</div>
<div id='mainHolder1'></div>
<script language='Javascript' type='text/javascript'>
initJavaScript('20', 'mainHolder', 'main', '1');
</script>
 

I tried it on my site here.

Hope this helps.
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Page navigation

All times are EDT. The time is now 06:55 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content