Our FamilyForum

FamilyForum Documentation & Help => FamilyForum Features & Guidelines => Code & Stuff => Topic started by: Ken on December 09, 2018, 07:42:30 AM

Title: TinyPortal Navigation Button
Post by: Ken on December 09, 2018, 07:42:30 AM
BigGuy started a topic over on TP about adding an Articles link under the TinyPortal navigation button and I'm trying to get it to work here.
https://www.tinyportal.net/index.php?topic=36205.0

So far I've tried two different sets of code and both throw errors, the latest one throws this error:
Quote
syntax error, unexpected '=>' (T_DOUBLE_ARROW)

Code goes in TPSubs.php
The code:
Code: [Select]
'articles' => array(
'title' => $txt['tp-articles'],
'href' => $scripturl . '?cat=ga',
'show' => !$user_info['is_guest'],
'sub_buttons' => array(
),
),
Title: Re: TinyPortal Navigation Button
Post by: Skhilled on December 09, 2018, 07:55:06 AM
First, the select link for selecting the code shown doesn't work for me. I'm using FF. I get the same at TP. I just didn't want to forgot to mention that...

Second, do you use the code Geoff used?

Code: [Select]
   if($context['user']['is_logged'])
        $buts['articles'] = array(
            'title' => $txt['tp-articles'],
            'href' => 'https://www.whatsurbeef.net/index.php?cat=ga',
            'show' => true,
            'active_button' => false,
            'sub_buttons' => array(),
        );
Title: Re: TinyPortal Navigation Button
Post by: Ken on December 09, 2018, 08:04:38 AM
I tried his code (using the OFF address) and it threw a blank page.

Maybe the 'https://www.ourfamilyforum.org/FamilyForum/index.php' should be dropped and just use the '?cat=ga'
Title: Re: TinyPortal Navigation Button
Post by: Skhilled on December 09, 2018, 08:06:23 AM
Maybe there's a conflict somewhere?
Title: Re: TinyPortal Navigation Button
Post by: Ken on December 09, 2018, 08:16:39 AM
I tried his code (using the OFF address) and it threw a blank page.

Maybe the 'https://www.ourfamilyforum.org/FamilyForum/index.php' should be dropped and just use the '?cat=ga'

Just tried this and got the error page:
Quote
syntax error, unexpected '=>' (T_DOUBLE_ARROW)
Title: Re: TinyPortal Navigation Button
Post by: Skhilled on December 09, 2018, 08:46:52 AM
Show me the code where you add it plus a 10 lines or so above and below the code.
Title: Re: TinyPortal Navigation Button
Post by: Ken on December 09, 2018, 09:11:15 AM
In the TPSubs file @about line 241 look for "// the Articles link"
Code: [Select]
// the Articles link
   if($context['user']['is_logged'])
        $buts['articles'] = array(
            'title' => $txt['tp-articles'],
            'href' => '?cat=ga',
            'show' => true,
            'active_button' => false,
            'sub_buttons' => array(),
        );
There you'll find the latest try, plus the previous try as well, "// the Articles link #2 old"
Code: [Select]
// the Articles link #2 old
/*   if($context['user']['is_logged'])
        $buts['articles'] = array(
            'title' => $txt['tp-articles'],
            'href' => '?cat=ga',
            'show' => true,
            'active_button' => false,
            'sub_buttons' => array(),
        ); */

In the TPortal.english.php file @about line 23 look for this code:
Code: [Select]
$txt['tp-articles'] => 'Articles';
Title: Re: TinyPortal Navigation Button
Post by: Skhilled on December 09, 2018, 03:07:57 PM
The select issue seems to only be with Firefox for some reason.

Anywho, you're code is incorrect in TPortal.english.php. This:

Code: [Select]
$txt['tp-articles'] => 'Articles';
Should be this:

Code: [Select]
$txt['tp-articles'] = 'Articles';
The arrow is never used in the language files that I'm aware of. Look at the other code. ;)

And in TPSubs the other code above and below it has "$scripturl" in the link like the follow and yours doesn't:

Code: [Select]
if($context['user']['is_logged'])
$buts['tpeditwonarticle'] = array(
'title' => $txt['tp-myarticles'],
'href' => $scripturl . '?action=tpmod;sa=myarticles',
'show' => true,
'active_button' => false,
'sub_buttons' => array(),
);
Title: Re: TinyPortal Navigation Button
Post by: Ken on December 10, 2018, 10:59:11 AM
Lost my internet connection mid-day yesterday due to the snow storm and it's just now back on, but kind of in and out. I'll try to get back on the articles link soon.
Title: Re: TinyPortal Navigation Button
Post by: Ken on December 10, 2018, 11:59:04 AM
Just had this interchange with BigGuy over on TP:
OK, it's sorted now, but the "?cat=ga" throws an error page so the 'ga' needs to be changed. I'll play with it a little to see what works.

Error:
Quote
The category doesn't exist.

Rename a category to General Articles.

Ah! Ha! Progress.
There was already a category called 'General articles' so I renamed it to 'General Articles' but that didn't change anything. But, while in that screen I noticed that the Short name option was blank so 'ga' was added and that fixed the link. Now it's just a matter of refining what gets displayed when the link is clicked. 

Thanks BigGuy. O0

I'm also going to look at your code Steve, the link needs to be refined to give more detail.