Our FamilyForum
FamilyForum Documentation & Help => FamilyForum Features & Guidelines => Code & Stuff => Topic started 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:
syntax error, unexpected '=>' (T_DOUBLE_ARROW)
Code goes in TPSubs.php
The code:
'articles' => array(
'title' => $txt['tp-articles'],
'href' => $scripturl . '?cat=ga',
'show' => !$user_info['is_guest'],
'sub_buttons' => array(
),
),
-
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?
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(),
);
-
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'
-
Maybe there's a conflict somewhere?
-
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:
syntax error, unexpected '=>' (T_DOUBLE_ARROW)
-
Show me the code where you add it plus a 10 lines or so above and below the code.
-
In the TPSubs file @about line 241 look for "// the Articles link"
// 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"
// 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:
$txt['tp-articles'] => 'Articles';
-
The select issue seems to only be with Firefox for some reason.
Anywho, you're code is incorrect in TPortal.english.php. This:
$txt['tp-articles'] => 'Articles';
Should be this:
$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:
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(),
);
-
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.
-
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:
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.