[[!GalleryItem? &id=`id`]]
<form method="post" action="[[~[[*id]]]]"> <input type="text" value="Search..." name="query" /> <input type="submit" value="Find" name="completedsearch" /> </form>
<?php
if(isset($_POST['completedsearch']))
{
$term = $_POST['query'];
$mysql = mysql_connect("localhost","username","password");
mysql_select_db("databasename
$qu = mysql_query("SELECT * FROM database__gallery_table WHERE name LIKE '%{$term}%' OR description LIKE '%{$term}%'"); //selects the row that contains ANYTHING like the submitted string
echo "<h2>Gallery Content</h2>";
while($row = mysql_fetch_array($qu))
{
echo $row['name'];
echo "[[!GalleryItem? &id=`ID OF THE GALLERY ITEM`]]";
}
}This question has been answered by sottwell. See the first response.
$itemId = $row['id'];
$output .= $row['name'];
$output .= $modx->runSnippet('GalleryItem', array('id'=>$itemId, 'tpl'=>'myTpl', ...));
return $output;,...
<?php
if(isset($_POST['completedsearch']))
{
$term = $_POST['query'];
$mysql = mysql_connect("localhost","username","password");
mysql_select_db("database name");
$qu = mysql_query("SELECT * FROM website_gallery_items WHERE name LIKE '%{$term}%' OR description LIKE '%{$term}%'"); //selects the row that contains ANYTHING like the submitted string
echo "<h2>Gallery Content</h2>";
while($row = mysql_fetch_array($qu))
{
$itemId = $row['id'];
$output .= $row['name'];
$output .= $modx->runSnippet('GalleryItem', array('id'=>$itemId, 'tpl'=>'CHK-TPL-gallery-item'));
return $output;
}
}&toPlaceholders=`0`
<form method="post" action="[[~[[*id]]]]"> <input type="text" value="Search..." name="query" /> <input type="submit" value="Find" name="completedsearch" /> </form>
if(isset($_POST['completedsearch']))
{
$term = $_POST['query'];
$mysql = mysql_connect("localhost","username","password");
mysql_select_db("database_name");
$qu = mysql_query("SELECT * FROM modx_gallery_items WHERE name LIKE '%{$term}%' OR description LIKE '%{$term}%'"); //selects the row that contains ANYTHING like the submitted string
echo "<h2>Gallery Content</h2>";
while($row = mysql_fetch_array($qu)) {
$itemId = $row['id'];
$output .= $modx->runSnippet('GalleryItem', array(
'id'=>$itemId,
'tpl'=>'myTpl',
'toPlaceholders'=>'0'
));
}
return $output;
}