Topics

User Functions

Events

There are no upcoming events

What's New

Stories

1 new Stories in the last 2 weeks

Comments last 2 weeks

No new comments

Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

NEW FILES last 14 days

No new files

Welcome to Geeklog Friday, May 24 2013 @ 04:06 PM EDT


 Forum Index > Extensions > PHP Blocks New Topic Post Reply
 Tabbed blocks
First | Previous | 1 2 | Next | Last
   
suprsidr
 09/17/05 11:55AM  
+++++
Full Member

Status: offline


Registered: 12/29/04
Posts: 552
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
PHP 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
 
Profile Email Website
 Quote
ronack
 09/18/05 09:18AM  
+++++
Full Member

Status: offline


Registered: 05/27/03
Posts: 602
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

 
Profile Email
 Quote
ronack
 09/18/05 09:23AM  
+++++
Full Member

Status: offline


Registered: 05/27/03
Posts: 602
I changed TEST to TABS.

 
Profile Email
 Quote
suprsidr
 09/18/05 10:21AM  
+++++
Full Member

Status: offline


Registered: 12/29/04
Posts: 552
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
 
Profile Email Website
 Quote
ronack
 09/18/05 12:44PM  
+++++
Full Member

Status: offline


Registered: 05/27/03
Posts: 602
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.

 
Profile Email
 Quote
suprsidr
 09/18/05 12:57PM  
+++++
Full Member

Status: offline


Registered: 12/29/04
Posts: 552
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
 
Profile Email Website
 Quote
suprsidr
 09/19/05 06:51PM  
+++++
Full Member

Status: offline


Registered: 12/29/04
Posts: 552
Hey Ron, I fixed your layout problem,
add this to your stylesheet:
PHP 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:
PHP 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
 
Profile Email Website
 Quote
First | Previous | 1 2 | Next | Last
Content generated in: 0.80 seconds
New Topic Post Reply

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