Arlima icon indicating copy to clipboard operation
Arlima copied to clipboard

Using file includes as child items in lists

Open aaslun opened this issue 10 years ago • 2 comments

We're looking at a way to have a file include to represent one or more articles by tags, providing tag-slugs as file arguments. This could be useful at times when no regular editors are in place to update the arlima lists, such as at night time. It could provide an easy way for any author to directly publish articles into an Arlima list without any knowledge of Arlima by simply tagging the article with an agreed tag, letting the file include do the work.

file include child

This concept works for top level file includes, but as soon as you place a file include as a child of an article in the list, no arlima_file_args arguments are passed to the php-file and does not seem to execute properly. It also triggers the following warning:

PHP Warning:  array_merge(): Argument #2 is not an array in /var/www/site/public/wp-content/plugins/arlima/arlima.php on line 322

...which is in this function...

/**
 * @param array $default
 * @return array|bool
 */
function arlima_file_args($default) {
    if( Arlima_FileInclude::isCollectingArgs() ) {
        Arlima_FileInclude::setCollectedArgs($default);
        return false;
    } else {
        return array_merge($default, Arlima_FileInclude::currentFileArgs());
    }
}

Is this something that you think can be fixed by intercepting a filter or action in Arlima or should it be considered a feature request?

aaslun avatar Oct 16 '14 11:10 aaslun

... it's maybe even a bug. I will look into it.

victorjonsson avatar Oct 16 '14 13:10 victorjonsson

Okey, I think I know what could cause this. I could try to explain it in words but a picture would be better suited to display the process behind this error.... and I don't have time for that :)

I think the problem here is that the current file arguments is stored in a static variable. What puzzles me is that you say that this only happens when the file is included in a child article.... I will investigate some more...

PS. Be aware of the risk of infinite loops when you have a file include that renders another list :)

victorjonsson avatar Oct 17 '14 14:10 victorjonsson