XF 2.3 Stumped on a template <xf:if> loop

Wildcat Media

Well-known member
Licensed customer
I have some modifications I'm trying to apply using a template. By looking at another add-on I dissected, the following works as expected in that add-on:

<xf:if is="in_array({$forum.node_id}, $xf.options.includeTheseNodes)">

However, it is not working for me, as I'm getting this error:

Extension public:thread_list_macros :: meta_cell() error: Cannot access offset of type string on string

I'm attempting to do this in thread_list_macros but inside the meta_cell extension. Now I'm thinking that using this conditional inside an extension (like meta_cell) is not permitted...?

I also cannot create two different meta_cell extensions (or any others), as it throws an error saying that meta_cell is already defined (and would do the same for other extensions). So, I can't do this either:

Code:
<xf:if is="my conditionals">
    <xf:extension id="meta_cell">
        my new extension stuff here
    </xf:extension>
<xf:else />
    <xf:extension id="meta_cell">
        original extension code here
    </xf:extension>
</xf:if>

The code above works in the other add-on I looked at, still in the thread_list_macros template, but it is not within an extension.
 
what is $xf.options.includeTheseNodes value?

it may be taking that in as string. maybe wrap it in [] or something?
 
what is $xf.options.includeTheseNodes value?
It's an array of selected nodes, from a list. I actually lifted this from another add-on, where it works. Dumping specific variables at the bottom of each page, it shows the array and the node ID.

1790973244731.webp

"35" is the node I'm currently visiting, and the array of 87 and 66 are the two forum IDs in the array of selected nodes.

I just don't know if I can assign variables within <xf:extension>...as that seems to be the difference.
 
I have some modifications I'm trying to apply using a template. By looking at another add-on I dissected, the following works as expected in that add-on:

<xf:if is="in_array({$forum.node_id}, $xf.options.includeTheseNodes)">

I also cannot create two different meta_cell extensions (or any others), as it throws an error saying that meta_cell is already defined (and would do the same for other extensions). So, I can't do this either:

Code:
<xf:if is="my conditionals">
    <xf:extension id="meta_cell">
        my new extension stuff here
    </xf:extension>
<xf:else />
    <xf:extension id="meta_cell">
        original extension code here
    </xf:extension>
</xf:if>
Try swapping the nesting:
Code:
    <xf:extension id="meta_cell">
<xf:if is="my conditionals">
  my new extension stuff here

<xf:else />
        original extension code here
   </xf:if>
 </xf:extension>
 
Try swapping the nesting:
Code:
    <xf:extension id="meta_cell">
<xf:if is="my conditionals">
  my new extension stuff here

<xf:else />
        original extension code here
   </xf:if>
 </xf:extension>
That is how I have it coded now, and that is what doesn't work. It logically should work, but I think we can't alter anything within extensions by adding conditionals. That's the only difference I can find.

The other code block I posted was an example of what also doesn't work, as meta_cell can't be declared twice, even if it's nested in a conditional.
 
Trying that didn't change anything.

The error seems to be that the variables aren't passing into the extension. Seems like it isn't seeing the needle and/or the haystack. Cannot access offset of type string on string

It's probably too late for XF staff to reply to this.
 
Back
Top Bottom