PDA

View Full Version : [RELEASE] Admin Hack - Search Templates!


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]

06-17-2000, 07:02 PM
Hello,

Thanks for the hack! This will bve very useful. :)

I get an error:
Parse error: parse error, expecting `'('' in /home/paintballcity/forums/vb/admin/template.php on line 116

I'm sure I followed the easy directions correctly. Maybe I'm too tired...its late. I'll tackle this in the morning. Thanks again.

06-17-2000, 07:09 PM
Should work now...I had an old version (non-working) of the code in my clipboard when I made the post :/

06-18-2000, 04:25 AM
ohhh kinky...oh behave... :)

06-19-2000, 02:48 AM
uuuhhhm?!?!

06-19-2000, 07:13 AM
I've been watching too much Austin Powers.

[Edited by VirtueTech on 06-19-2000 at 04:14 PM]

06-24-2000, 02:49 AM
Nice job. Really helps out a lot.

07-26-2000, 04:37 PM
Gosh, this is a nice hack. Wish I'd installed it a few weeks ago before monkeying around so much with my templates! Thanks very much.

07-26-2000, 09:38 PM
Stallion:

I am not sure what you mean by "above the first line" and "below the second line". First line or above the Start Modify? Second line or below the if action=modify line? Is that what you mean?

Parker

07-27-2000, 02:00 PM
The
// ####################### Search sub ######################## stuff is inserted immediately before the // ###################### Start modify ####################### line in the template.php file, and the "searchcode();" line is inserted in the template.php file so that it becomes the next line after if ($action=="modify") { in template.php


[Edited by Dave Baker on 07-27-2000 at 11:02 AM]

07-27-2000, 08:54 PM
Dave:

Thanks.

Parker

01-06-2001, 09:27 AM
Works ok on 1.1.5 thanks:D

01-06-2001, 01:53 PM
Yeah I installed this hack with sucess. :)

01-06-2001, 05:20 PM
Works good for me. Thanks, it will be a big help!