06-17-2000, 06:10 PM
Oh yes, never again will you have to waste time searching through the template list to find just what you need -- just do a search!
Tested lightly, but it should work. Let me know if you find any bugs!
In admin/template.php...
Look for:// ###################### Start modify #######################
if ($action=="modify") {Above the first line, add:// ####################### Search sub ########################
function searchcode() {
print "<p>";
global $like;
if ($like) {
print "<b>Previous Search</b>:\n<br>\n";
$likeout = htmlentities($like);
print $likeout."<p>\n";
$like = addslashes($like);
}
?>
<form action="template.php">
<input type=hidden name=action value=search>
<b>Search for templates containing</b>:<br>
<input type=text name=like size=50><br>
<input type="submit" value="Search Templates!">
</form>
<br>
<?
}
// ###################### Start search #######################
if ($action=="search") {
searchcode();
echo "<p><ul>\n";
$templates=$DB_site->query("SELECT templateid,title FROM template WHERE title<>'options' and template like '%$like%' ORDER BY title");
while ($template=$DB_site->fetch_array($templates)) {
echo "<li>$template[title] <a href=\"template.php?action=edit&templateid=$template[templateid]\">[edit]</a> <a href=\"template.php?action=remove&templateid=$template[templateid]\">[delete]</a></li>\n";
}
echo "</ul></p>\n";
echo "<p>That's all folks</p>\n";
}And below the second line, add:searchcode();
A real life saver for some of us ;)
[Edited by Stallion on 06-18-2000 at 04:09 AM]
Tested lightly, but it should work. Let me know if you find any bugs!
In admin/template.php...
Look for:// ###################### Start modify #######################
if ($action=="modify") {Above the first line, add:// ####################### Search sub ########################
function searchcode() {
print "<p>";
global $like;
if ($like) {
print "<b>Previous Search</b>:\n<br>\n";
$likeout = htmlentities($like);
print $likeout."<p>\n";
$like = addslashes($like);
}
?>
<form action="template.php">
<input type=hidden name=action value=search>
<b>Search for templates containing</b>:<br>
<input type=text name=like size=50><br>
<input type="submit" value="Search Templates!">
</form>
<br>
<?
}
// ###################### Start search #######################
if ($action=="search") {
searchcode();
echo "<p><ul>\n";
$templates=$DB_site->query("SELECT templateid,title FROM template WHERE title<>'options' and template like '%$like%' ORDER BY title");
while ($template=$DB_site->fetch_array($templates)) {
echo "<li>$template[title] <a href=\"template.php?action=edit&templateid=$template[templateid]\">[edit]</a> <a href=\"template.php?action=remove&templateid=$template[templateid]\">[delete]</a></li>\n";
}
echo "</ul></p>\n";
echo "<p>That's all folks</p>\n";
}And below the second line, add:searchcode();
A real life saver for some of us ;)
[Edited by Stallion on 06-18-2000 at 04:09 AM]