PDA

View Full Version : Hook after Quick Links??


TheAdminMarket
10-30-2015, 10:53 AM
Hello,

I'm trying to add a simple menu link after "Quick Links", but I was never good enought to locate the correct hook. Can someone helps?


<plugin active="1" executionorder="30">
<title>Forum Link</title>
<hookname>cache_templates</hookname>
<phpcode><![CDATA[
$templater = vB_Template::create('teamtalk_forum_link');
$template_hook['navtab_end'] .= $templater->render();
]]></phpcode>
</plugin>


and the simple template is:

<template name="teamtalk_forum_link" templatetype="template" date="1160112327" username="ChrisTERiS" version="1.0.0"><![CDATA[
<li id="vbflink_teamtalk"><a href="teamtalk.php">{vb:var vbphrase.teamtalk_global}</a></li>
]]></template>


Thank you

ozzy47
10-30-2015, 11:23 AM
Why not create it with the navigation manager?

TheAdminMarket
10-30-2015, 11:29 AM
Why not create it with the navigation manager?

I don't want Tab. Just a Link in forum. Never tried to add something like this with a product file.

Dave
10-30-2015, 11:34 AM
I believe it's the "navbar_end" template hook.
We're talking about the sub-menu under the main navbar right?

ozzy47
10-30-2015, 11:34 AM
I know, you can make a link, and assign it to a product with the nab manager. :) So when you export your product XML it will have the navigation entry with it.

TheAdminMarket
10-30-2015, 02:25 PM
I believe it's the "navbar_end" template hook.
We're talking about the sub-menu under the main navbar right?

I tried but does not works :(
Anyway thank you David

--------------- Added 1446218808 at 1446218808 ---------------

I know, you can make a link, and assign it to a product with the nab manager. :) So when you export your product XML it will have the navigation entry with it.

I also tried this but adding a link is blocked (read only) to vBulletin product. I can't assign it to another product.

MarkFL
10-30-2015, 02:39 PM
What I did in one of my products to add a link to the "Quick Links" drop-down menu is use the plugin hook "global_setup_complete" and the plugin code:

$template_hook['navtab_end'] .= '
<script>
var qlink = document.getElementById("vbmenu_qlinks").lastElementChild;
if (qlink)
{
var newlink = document.createElement("li");
newlink.innerHTML = "put link here";
qlink.appendChild(newlink);
}
</script>';

TheAdminMarket
10-30-2015, 02:41 PM
Finally I created a Tab menu for it and if someone wants to move it somewhere he can do it by copying the link and permissions. :)

--------------- Added 1446219813 at 1446219813 ---------------

What I did in one of my products to add a link to the "Quick Links" drop-down menu is use the plugin hook "global_setup_complete" and the plugin code:

$template_hook['navtab_end'] .= '
<script>
var qlink = document.getElementById("vbmenu_qlinks").lastElementChild;
if (qlink)
{
var newlink = document.createElement("li");
newlink.innerHTML = "put link here";
qlink.appendChild(newlink);
}
</script>';


Tried your solution Mark but does not seems to work.

Paul M
10-30-2015, 02:43 PM
I don't want Tab. Just a Link in forum. Never tried to add something like this with a product file.

Still just add a link in nav manager, and associate it with your product.

When you export the product, it will export the link in the xml.

MarkFL
10-30-2015, 02:46 PM
Christos, try:

$template_hook['navtab_end'] .= '
<script>
var qlink = document.getElementById("vbmenu_qlinks");
if (qlink)
{
var newlink = document.createElement("li");
newlink.innerHTML = "put link here";
qlink.lastElementChild.appendChild(newlink);
}
</script>';

TheAdminMarket
10-30-2015, 04:30 PM
Still just add a link in nav manager, and associate it with your product.

When you export the product, it will export the link in the xml.

Seems that my mind has messed at all. Ok, I clicked at Navigation Manager, I selected Add Link from Forum selector and then I added a link. I was unable to choose product as vBulletin was preselected (see attached screenshot). But the links appears ok.

The novice question now. What product do I need to download to copy the code? I downloaded the style but there is nothing there. I seen in the Products list but only CMS and Blog exist.

TheAdminMarket
10-30-2015, 04:33 PM
Christos, try:

$template_hook['navtab_end'] .= '
<script>
var qlink = document.getElementById("vbmenu_qlinks");
if (qlink)
{
var newlink = document.createElement("li");
newlink.innerHTML = "put link here";
qlink.lastElementChild.appendChild(newlink);
}
</script>';


Javascript guru Mark? :) I'll try it as last chance if I don't find another way to place is in a more visible place. Actually the best for me is to add after Private Messages as it's a Conversation System :)

squidsk
10-30-2015, 04:52 PM
Seems that my mind has messed at all. Ok, I clicked at Navigation Manager, I selected Add Link from Forum selector and then I added a link. I was unable to choose product as vBulletin was preselected (see attached screenshot). But the links appears ok.

The novice question now. What product do I need to download to copy the code? I downloaded the style but there is nothing there. I seen in the Products list but only CMS and Blog exist.
You need to put the forum into debug mode I believe for that option to be selectable.

If you want to make it debug mode for just yourself add the following to your config.php where A.B.C.D is your IP address.

$config['Misc']['debug'] = ($_SERVER['REMOTE_ADDR'] == "A.B.C.D");