TinyPortal

Development => Block Codes => Topic started by: Nokonium on February 04, 2006, 07:10:33 PM

Title: Some format finessing
Post by: Nokonium on February 04, 2006, 07:10:33 PM
I've been fiddling ........

Recent Topics

I've had a go at reformatting the Recent Topics Block (TPortalBlocks.template). I have added bullets, removed the line across (HR) and closed the gap a bit. I know that the bullet removes content from a line with hidden overflow but I think that the overall effect is better. The 'New' icon is clickable as with the forums.

// TPortal recent topics block
function TPortal_recentbox()
{
    global $context, $settings, $options, $txt , $modSettings;
    // is it a number?
    if(!is_numeric($context['TPortal']['recentboxnum']))
                     $context['TPortal']['recentboxnum']='10';

    // leave out the recycle board, if any
    if(isset($modSettings['recycle_board']))
      $bb=array($modSettings['recycle_board']);
    else
      $bb=array();

    $what=ssi_recentTopics($num_recent = $context['TPortal']['recentboxnum'], $bb, $output_method = 'array');
    // Output the topics
        $counter=1; $cmax=count($what);
    foreach($what as $w){
            echo '<div style="white-space: nowrap; overflow: hidden; padding: 0px 4px;" class="smalltext">
                  <img src="'.$settings['images_url'].'/TPdivider.gif" alt="" />&nbsp;<b><a href="'.$w['href'].'">'.$w['short_subject'].'</a></b>
                                    </div>
                                    <div style="white-space: nowrap; overflow: hidden; padding: 0px 4px; " class="smalltext">';
            if(!$w['new'])
               echo '<a href="'.$w['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';

                        echo '<img src="'.$settings['images_url'].'/blank.gif" alt="" width="12" / >'.$w['time'].'</div>';

           if($counter != $cmax)
                   echo '<img src="'.$settings['images_url'].'/blank.gif" alt="" height="6" / >';
           $counter++;
    }
}



To get the best from this, and from other blocks, I suggest that you add this to the style.css. It will help with all block displays including RSS feeds.

.smalltext a:link, .smalltext a:visited
{
font-size: x-small;
font-family: verdana, sans-serif;
font-weight:700;
}


Content Menu

I like the way it looks, the span tags improve the display for me and the small caps help show the headers.

// TPortal categories
function TPortal_catmenu()
{
        global $context, $settings, $options , $scripturl;

    if(isset($context['TPortal']['menu']) && !empty($context['TPortal']['menu'])){
        foreach($context['TPortal']['menu'] as $cn){
             echo str_repeat("&nbsp;", ($cn['sub']+1));
             if((!isset($cn['icon']) || (isset($cn['icon']) && $cn['icon']=='')) && $cn['type']!='head' && $cn['type']!='spac'){
                 echo '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" />&nbsp;';
             }
             elseif(isset($cn['icon']) && $cn['icon']!='' && $cn['type']!='head' && $cn['type']!='spac'){
                 echo '<img alt="*" src="'.$cn['icon'].'" />&nbsp;';
             }

             switch($cn['type']){
                case 'cats' :
                    echo '<span class="smalltext"><a href="'. $scripturl. '?cat='.$cn['IDtype'].'" ' , $cn['newlink']=='1' ? 'target="_blank"' : '' , '>'.$cn['name'].'</a></span><br />';
                    break;
                case 'arti' :
                    echo '<span class="smalltext"><a href="'. $scripturl. '?page='.$cn['IDtype'].'"' , $cn['newlink']=='1' ? 'target="_blank"' : '' , '>'.$cn['name'].'</a></span><br />';
                    break;
                case 'link' :
                    echo '<span class="smalltext"><a href="'.$cn['IDtype'].'"' , $cn['newlink']=='1' ? 'target="_blank"' : '' , '>'.$cn['name'].'</a></span><br />';
                    break;
                case 'head' :
                    echo '<span class="smalltext" style="font-variant: small-caps; font-weight: bold;">'.$cn['IDtype'].'</span><br />';
                    break;
                case 'spac' :
                    echo '<br />';
                    break;
                default :
                    echo '<a href="'.$cn['IDtype'].'"' , $cn['newlink']=='1' ? 'target="_blank"' : '' , '>'.$cn['name'].'</a><br />';
                    break;
             }
        }
    }
}




[attachment deleted by admin]

[attachment deleted by admin]
Title: Re: Some format finessing
Post by: crip on February 04, 2006, 08:40:00 PM
What kind of Gallery are you using?..it's really nice.

Title: Re: Some format finessing
Post by: Nokonium on February 04, 2006, 10:49:55 PM
I have 3 links to galleries, only one is mine. The best one is Freds I think made with iView MediaPro. The ones of mine with the slideshow were made with Photoshop.
Title: Re: Some format finessing
Post by: crip on February 05, 2006, 10:14:35 AM
Home made, always the best..Ty.
Title: Re: Some format finessing
Post by: haktanir on February 19, 2006, 05:48:28 PM
I was wordering, is there a way to make RSS links open in new browser window? People lose the forum once they click on a news item.
Title: Re: Some format finessing
Post by: G6Cad on February 19, 2006, 07:32:30 PM
looks really great :) More of this kind of copy and paste code. This is the fun part when even I get it to work  :laugh:
Title: Re: Some format finessing
Post by: ramapoughnative on February 23, 2006, 03:58:36 PM
Could you tell me where you put the code under 'content menu' in your post?
Title: Re: Some format finessing
Post by: Nokonium on February 23, 2006, 05:17:02 PM
That is also in TPortalBlocks.template  :)
Title: Re: Some format finessing
Post by: ramapoughnative on February 23, 2006, 05:26:59 PM
Thanks!
Title: Re: Some format finessing
Post by: crip on February 23, 2006, 05:33:46 PM
Quote from: nokonium on February 23, 2006, 05:17:02 PM
That is also in TPortalBlocks.template  :)

you a fiddling, and i'm a piddling. ;D
Title: Re: Some format finessing
Post by: AdviseorAnswers.com on April 19, 2007, 02:38:38 AM
Help!! I added the content block and now I'm locked out of my site. All it will pull up now is the header. What can I do???
It gets to the block I added and then stops with this error...

Fatal error: Cannot redeclare tportal_catmenu() (previously declared in /home/adviseor/public_html/Sources/Load.php(1804) : eval()'d code:181) in /home/adviseor/public_html/Sources/Load.php(1804) : eval()'d code(35) : eval()'d code on line 38

www.adviseoranswers.com
Title: Re: Some format finessing
Post by: Lesmond on April 19, 2007, 02:45:53 AM
site seems fine to me
Title: Re: Some format finessing
Post by: AdviseorAnswers.com on April 19, 2007, 02:50:02 AM
I don't understand it then. I'm still locked out. Could it be because I only had the block set for admin. to see? If so, any ideas on how I can remove it?
Title: Re: Some format finessing
Post by: Lesmond on April 19, 2007, 02:57:07 AM
have you tried http://www.adviseoranswers.com/index.php?action=admin

Always remember have it set set not to show blocks in your admin section

You have 2 members logged in BadDad and MAX
Title: Re: Some format finessing
Post by: AdviseorAnswers.com on April 19, 2007, 03:11:40 AM
I tried that. No matter what I do I get the same thing. Below is a snap shot of what I see. (I'm BadDad)
Title: Re: Some format finessing
Post by: IchBin on April 19, 2007, 03:24:11 AM
Thats because you have blocks set to on in the admin section. This is a very good reason that you should turn blocks OFF while in the admin section so that you can still access your admin panel.

You'll have to manually edit the database to turn the block off, or if you're browser is open you can sometimes hit the back button to go back to the edit page if its cached.
Title: Re: Some format finessing
Post by: AdviseorAnswers.com on April 19, 2007, 03:28:43 AM
I normally open a new window when testing a new block but I accidentally closed it this time. I will in the future turn off blocks in the admin area, for sure.

Can someone tell me how to edit the database, please?
Title: Re: Some format finessing
Post by: IchBin on April 19, 2007, 03:32:36 AM
Do you have phpMyAdmin ?
Title: Re: Some format finessing
Post by: AdviseorAnswers.com on April 19, 2007, 03:35:07 AM
yes
Title: Re: Some format finessing
Post by: AdviseorAnswers.com on April 19, 2007, 04:12:33 AM
bump?
Title: Re: Some format finessing
Post by: AdviseorAnswers.com on April 19, 2007, 04:40:17 AM
Can anyone tell me how to fix this. PLEASE
Title: Re: Some format finessing
Post by: Shadow on April 19, 2007, 05:04:54 AM
You have to go throw phpMyAdmin to edit the database for the blocks.  I think you have to found the blocks tags in there but be safe in the database.  If you ain't being safe in the database it can miss up your forum or crash your site too.  Someone told me that before.

You will need to found this "Table: smf_tp_blocks" in the database.

I don't know how to do the rest of this now.
Title: Re: Some format finessing
Post by: IchBin on April 19, 2007, 05:35:03 AM
phpmyadmin > Select your database > select the blocks table that Shadow pointed out, click browse > Find the block that is giving you problems > edit the column and change the "off" row to 1 instead of 0.
Title: Re: Some format finessing
Post by: IchBin on April 19, 2007, 05:35:21 AM
Did that work for you?
Title: Re: Some format finessing
Post by: IchBin on April 19, 2007, 05:35:54 AM
PLEASE!
TELL ME IF THIS HAS HELPEd YOU!

Title: Re: Some format finessing
Post by: IchBin on April 19, 2007, 05:36:12 AM
Where did you go?!



Did you get the point?.....
Title: Re: Some format finessing
Post by: Shadow on April 19, 2007, 05:46:52 AM
I hope this help him out about this problem
Title: Re: Some format finessing
Post by: Ken. on April 19, 2007, 11:06:55 AM
You are a good person IchBinâ„¢  :)


Of course you already knew that.  ;)
Title: Re: Some format finessing
Post by: AdviseorAnswers.com on April 19, 2007, 12:24:13 PM
I'm sorry Guys I did not abandon you on this one. I have dial up still and someone hit a telephone pole. So I was unable to connect. I am going now to try and fix this. I will let you know if it worked. Thank you
Title: Re: Some format finessing
Post by: Crip on April 19, 2007, 12:25:55 PM
Lol.. good one.
Title: Re: Some format finessing
Post by: AdviseorAnswers.com on April 19, 2007, 01:00:02 PM
Shadow Queen, IchBinâ„¢.
You two are GREAT! I can't thank you enough for helping me with this. If I can ever help either of you in anyway, just let me know. I really like this program and will be around for a long time. (well if i stop making these stupid mistakes; mental note: turn blocks off in Admin Area) But Like I was saying. THANK YOU VERY MUCH!

I will be adding your sites to my directory and featured links....
Shadow Queen, I have your forum from your signature already, do you have any other sites?

IchBinâ„¢, Do you have a site for me to add, other than TP?
Title: Re: Some format finessing
Post by: Shadow on April 19, 2007, 04:29:45 PM
Your most welcome :)

You are still learning about forum's and tp. 

No, I have one site only and Thank you for putting my site in your directory :)
Title: Re: Some format finessing
Post by: jepot on July 15, 2008, 10:36:57 AM
hi
nice work, but
how to exclude certain boards using this?
and also, hide the new button
and how to limit the characters

so it shows as ...
pls help me
Title: Re: Some format finessing
Post by: IchBin on July 15, 2008, 02:17:12 PM
jepot, have you looked at any of the other recent topics codes? There are ones already with the options you asking about.
Title: Re: Some format finessing
Post by: jepot on July 15, 2008, 02:44:19 PM
i have, but most of them are not like this
i want it to just list topics
then under date and time
separated by bullets
Title: Re: Some format finessing
Post by: zea on August 12, 2008, 02:27:45 AM
Is there a guide on how to set it up? I can't find anything on this forum on how to apply a mod. Thanks!