• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Nodes As Tabs (with tab selection)

Status
Not open for further replies.
Jake I have a custom made type of node which acts like a page on the site - it integrates with the node tree, permissions etc like an XF Pag, but it has other useful things I can do which is why I like it.
When I create or edit it in the admincp that's what it is like on the form - same fields as an XF Page.

But the nodes-as-tabs section of the node form I get with other nodes, doesn't appear.
What does nodes-as-tabs need in order for it to recognise this new node, as a node?
Or what does this new node need to provide for nodes-as-tabs to be allowed to display on its edit form and do its navbar stuff with it?

(I might not understand your answer but I can pass it to the coder who will. :) )
 
http://awesomescreenshot.com/0edsqk724

Any idea why my last 2 nodes wouldnt be showing up? They show up on the default theme... Im using Refresh.

It's possible they are wrapping and therefore "hidden". I've seen this happen when I've had too many items on the navbar. You can try decreasing the padding between each navbar item and see if they appear. You can also try disabling a mod or two that displays in the navbar and see if they then appear. If they do, then you know that's what the problem is.
 
Jake I have a custom made type of node which acts like a page on the site - it integrates with the node tree, permissions etc like an XF Pag, but it has other useful things I can do which is why I like it.
When I create or edit it in the admincp that's what it is like on the form - same fields as an XF Page.

But the nodes-as-tabs section of the node form I get with other nodes, doesn't appear.
What does nodes-as-tabs need in order for it to recognise this new node, as a node?
Or what does this new node need to provide for nodes-as-tabs to be allowed to display on its edit form and do its navbar stuff with it?

(I might not understand your answer but I can pass it to the coder who will. :) )

This addon explicitly covers four types of nodes... forums, categories, pages, and link forums. If it's not one of those types then the tab options will not show, and the code would have to be modified to include the new type.
 
This addon explicitly covers four types of nodes... forums, categories, pages, and link forums. If it's not one of those types then the tab options will not show, and the code would have to be modified to include the new type.

Thanks Jake I understood that much. Would it be possible to explain or show which code has to be modified so the new node type would show the tab options?
I assume that the node types have a key identifier in the code that your addon recognises. So how to add something that ensures your addon recognises this node as a node?
 
Thanks Jake I understood that much. Would it be possible to explain or show which code has to be modified so the new node type would show the tab options?
I assume that the node types have a key identifier in the code that your addon recognises. So how to add something that ensures your addon recognises this node as a node?

Edit this file:

library/NodesAsTabs/Listen.php

Add your node controller to the condition:

Code:
		if (in_array($class, array(
			'XenForo_ControllerAdmin_Page',
			'XenForo_ControllerAdmin_Forum',
			'XenForo_ControllerAdmin_Category',
			'XenForo_ControllerAdmin_LinkForum'
		)))
		{
			$extend[] = 'NodesAsTabs_ControllerAdmin_AllNodes';
		}

And an appropriate template hook to this condition (hopefully the admin template for the node has a hook to use):

Code:
		if (in_array($hookName, array(
			'admin_page_edit_basic_information',
			'forum_edit_basic_information',
			'admin_category_edit',
			'admin_link_forum_edit'
		)))
		{

And you will need to edit this file:

library/NodesAsTabs/Model/Options.php

Add a condition to this function for your node:

Code:
	public function buildLink($node)
	{
		$retval = '';

		if ($node['node_type_id'] == 'Page')
		{
			$retval = XenForo_Link::buildPublicLink('full:pages', $node);
		}
		else if ($node['node_type_id'] == 'Forum')
		{
			$retval = XenForo_Link::buildPublicLink('full:forums', $node);
		}
		else if ($node['node_type_id'] == 'Category')
		{
			$retval = XenForo_Link::buildPublicLink('full:categories', $node);
		}
		else if ($node['node_type_id'] == 'LinkForum')
		{
			$retval = XenForo_Link::buildPublicLink('full:link-forums', $node);
		}

		return $retval;
	}

Similarly, edit this template and add a condition for your type of node:

Admin CP -> Appearance -> Templates -> nat_childlinks

Code:
<xen:foreach loop="$firstChildNodes" value="$childNode">
<li>
	<xen:if is="{$childNode.node_type_id} == 'Page'">
		<a href="{xen:link 'pages', $childNode}">{$childNode.title}</a>
	<xen:elseif is="{$childNode.node_type_id} == 'Forum'" />
		<a href="{xen:link 'forums', $childNode}">{$childNode.title}</a>
	<xen:elseif is="{$childNode.node_type_id} == 'Category'" />
		<a href="{xen:link 'categories', $childNode}">{$childNode.title}</a>
	<xen:elseif is="{$childNode.node_type_id} == 'LinkForum'" />
		<a href="{xen:link 'link-forums', $childNode}">{$childNode.title}</a>
	</xen:if>
</li>
</xen:foreach>

I think that's everything.
 
A new version has been added to the first post (NodesAsTabs 1.1.1.zip). This is strictly a security patch. Older versions have been removed because they were insecure.

I discovered the exploit myself while reviewing some code. The exploit is not in the open, but everyone should upgrade to the newest version ASAP.

edit - I am having trouble actually exploiting the vulnerability, but it definitely needed to be patched.
 
Thanks for the heads up.

I am still surprised by when I update xenForo or the add-ons. In the case of this add-on, I cannot believe I did not have to re-add the edits I made relating to it.
 
Rebuilding Caches...

An error occurred or the request was stopped.


uhhhhhhhhh... edit: seems to have finished now. Weird.
 
A new version has been added to the first post (NodesAsTabs 1.1.1.zip). This is strictly a security patch. Older versions have been removed because they were insecure.

I discovered the exploit myself while reviewing some code. The exploit is not in the open, but everyone should upgrade to the newest version ASAP.

edit - I am having trouble actually exploiting the vulnerability, but it definitely needed to be patched.
And the hunt begins ;)
 
I asked on another thread about making a Link Forum open in another tab or page. Jake kindly gave me a thread about converting all Link Forums to target="_blank But really the question belongs here.

I am using quite a few LinkForums to get nodes-as-tabs to work and structure my navtabs.
All the secondary tabs are fine - I can put in the target="_blank code in the links template on the ones where I need it.

But I have 2 top level tabs which need to open in new tabs/ pages. One is the Admin menu headerfor my quicklinks admin menu; the other is an external chatroom. Both are using Link Forums.
 
I asked on another thread about making a Link Forum open in another tab or page. Jake kindly gave me a thread about converting all Link Forums to target="_blank But really the question belongs here.

I am using quite a few LinkForums to get nodes-as-tabs to work and structure my navtabs.
All the secondary tabs are fine - I can put in the target="_blank code in the links template on the ones where I need it.

But I have 2 top level tabs which need to open in new tabs/ pages. One is the Admin menu headerfor my quicklinks admin menu; the other is an external chatroom. Both are using Link Forums.

You will have to edit the skeleton in this template:

Admin CP -> Appearance -> Templates -> navigation

Add the red code:

Rich (BB code):
		<!-- extra tabs: end -->
		<xen:if is="{$extraTabs.end}">
		<xen:foreach loop="$extraTabs.end" key="$extraTabId" value="$extraTab">
			<xen:if is="{$extraTab.linksTemplate}">
				<li class="navTab {$extraTabId} {xen:if $extraTab.selected, 'selected', 'Popup PopupControl PopupClosed'}">
			
				<a {xen:if '{$extraTab.nodeTab.node_type_id} == "LinkForum"', 'target="_blank"'} href="{$extraTab.href}" class="navLink">{$extraTab.title}</a>
				<a {xen:if '{$extraTab.nodeTab.node_type_id} == "LinkForum"', 'target="_blank"'} href="{$extraTab.href}" class="SplitCtrl" rel="Menu"></a>
				
				<div class="{xen:if {$extraTab.selected}, 'tabLinks', 'Menu JsOnly tabMenu'}">
					<div class="primaryContent menuHeader">
						<h3>{$extraTab.title}</h3>
						<div class="muted">{xen:phrase quick_links}</div>
					</div>
					{xen:raw $extraTab.linksTemplate}
				</div>
			</li>
			<xen:else />
				<li class="navTab {xen:if $extraTab.selected, 'selected', 'PopupClosed'}">
					<a {xen:if '{$extraTab.nodeTab.node_type_id} == "LinkForum"', 'target="_blank"'} href="{$extraTab.href}" class="navLink">{$extraTab.title}</a>
					<xen:if is="{$extraTab.selected}"><div class="tabLinks"></div></xen:if>
				</li>
			</xen:if>
		</xen:foreach>
		</xen:if>

There are two other "extraTabs" blocks for the home and middle positions. You might have to apply the same change to those blocks as well, depending on the position of the tab.
 
Question - how does using the tabs as nodes affect SEO?
I think Nodes as Tabs makes information much more easily findable. This is likely to increase google visitors time on your site as they find things they like. Google likes it when people stay on your site longer. Google likes you = better search rankings for your site / pages.
 
Status
Not open for further replies.
Top Bottom