modmore / GithubIssues

Reads issues from Github, marked with a specific tag. Developed by @rtripault
1 stars 1 forks source link

Multiple usage of the getIssues snippet in one Resource results in blank page #7

Closed gadgetto closed 10 years ago

gadgetto commented 10 years ago

Probably it's again me - but If I try to use the getIssues Snippet more then once in a Resource, the result is a blank page. Single usage works like a charm!

Here is the code I'm using in the Resource:

<h3>Known Issues</h3>
<ul>
[[!getIssues?
    &tpl=`issue`
    &emptyMsg=`<li>Currently no open issues</li>`
    &label=`bug`
    &state=`open`
    &fromUser=`/username/`
    &forRepo=`/RepoName/`
]]
</ul>

<h3>Closed Issues</h3>
<ul>
[[!getIssues?
    &tpl=`issue`
    &emptyMsg=`<li>No closed issues</li>`
    &label=`bug`
    &state=`closed`
    &fromUser=`/username/`
    &forRepo=`/RepoName/`
]]
</ul>
Mark-H commented 10 years ago

Works fine on the modmore site:

[[!getIssues? &amp;label=`Publicly Visible` &amp;fromUser=`modmore` &amp;forRepo=`Redactor` &amp;tpl=`githubIssue`]]
</p>
<h3>Closed Issues</h3>
<ul>
[[!getIssues? &amp;label=`Publicly Visible` &amp;fromUser=`modmore` &amp;forRepo=`Redactor` &amp;tpl=`githubClosedIssue` &amp;state=`closed`]]
</ul>
gadgetto commented 10 years ago

Hmm... can't see any relevant difference. Really don't know why this doesn't work here.

gadgetto commented 10 years ago

Mark, I built the transport package from the current develop branch (which is a little bit ahead of the master). Could this be the difference/problem?

gadgetto commented 10 years ago

Found the bug:

    function sortMe(&$array, $column, $sortDir)
    {
        $sortDir = strtoupper($sortDir);
        // Grab a sorted array
        $sorted = array();
        foreach ($array as $key => $row) {
            $sorted[$key] = $row[$column];
        }
        // Sort the original array accordingly
        array_multisort($sorted, constant($sortDir), $array);
    }

needs to be:

if (!function_exists('sortMe')) { 
    function sortMe(&$array, $column, $sortDir)
    {
        $sortDir = strtoupper($sortDir);
        // Grab a sorted array
        $sorted = array();
        foreach ($array as $key => $row) {
            $sorted[$key] = $row[$column];
        }
        // Sort the original array accordingly
        array_multisort($sorted, constant($sortDir), $array);
    }
}