I've created a User Defined Tag that does the following:
- Get the page-alias and adds a slash
- The gallery used on the webpage has the same name as the page-alias, so I use the page-alias to look up the name of the gallery in the database
- Then I used the corresponding fileid to look up all the pictures in that specific gallery and use a number of fields from the database to create output
- This output is used by a (third party) script to show the images on the screen. By the way, I'm very sure the error is not caused by this third party script (Galleria)
In the source of the webpage the message below is appearing, so it looks like there is an undefined variable in my script, but I really can't figure out what's wrong. And the strange thing is that the pictures are shown correctly on the website (see http://www.magnapostma.nl for an example)
I'd be very pleased if someone would have a look and give some advice!
Hans
The error message:
And the UDT<b>Notice</b>: Undefined variable: output in <b>/public/sites/www.magnapostma.nl/lib/classes/class.us ... c.php(265) : eval()'d code</b> on line <b>31</b
Code: Select all
// Get page-alias and add slash
$contentops = cmsms()->GetContentOperations();
$content_obj = $contentops->getContentObject();
$alias = $content_obj->Alias();
$alias=$alias . '/';
// Make a connection to the database
$db = cmsms()->GetDb();
// Use page-alias to find fileid of gallery in database
$query1 = "SELECT fileid FROM cms_module_gallery WHERE filename='$alias'";
$dbresult1 = $db->Execute($query1);
if ($dbresult1)
{
$row = $dbresult1->FetchRow();
$id = $row['fileid'];
$query2 = "SELECT filename, filepath, active, title, comment FROM cms_module_gallery WHERE galleryid='$id' AND active='1' ORDER BY fileorder ASC";
$dbresult2 = $db->Execute($query2);
if ($dbresult2)
{
while ($dbresult2 && $row = $dbresult2->FetchRow())
{
$file = $row['filename'];
$path = $row['filepath'];
$title = $row['title'];
$comment = $row['comment'];
$output = $output . "<a href=\"/uploads/images/Gallery/$path" . "$file\" /><img src=\"/uploads/images/Gallery/$path" . "thumb_" . "$file\" data-title=\"$title\" data-description=\"$comment\"></a>";
}
echo "$output";
}
}