May
5
Gallery2 whilst being an amazing gallery system to display and catalogue photos or pictures it does have some inflexibilities that make you weep.
Problem – The search box only brings up the first 3 results
What do you do? Most galleries will have more than 3 results. In the standard installation you have to click another button to get the full results and people have mentioned to me that it’s a bit of a bore. So I’ve written this easy to use guide to change this and sort out a decent first search. Let’s go on …. it’s not complicated but needs a few minutes of time.
Estimated time: 5 minutes
Before we get started let’s look at how it works in practice. Go to Pure Anime Gallery and search using ‘avatar’
Here’s what it looks like on a standard search

So, Let’s get going!
- 1. We need to start by looking inside the Gallery2 core and we’ll need to go into FTP for that. Launch your FTP client and navigate to: /modules/search/
- 2. Find SearchScan.inc . This controls the number of returned searches, so our first step is to modify this file. ** Be sure to take a copy somewhere safe on your PC before modifying anything**
- 3. Find line number 113 which reads:
/* TODO: Parameterize this */ $scanSize = 3; - 4. This value controls the maximum number of results. In this example we will create 12 so we change the following:
$scanSize = 12;
- 5. Our screenshot now looks like this :

As you can see we have got 12 searches BUT gallery2 has strung them into one big line, and it goes totally off the screen in one big table. - 6. NEXT we tell Gallery2 to insert table breaks to create a nice structure. For this example we will set it to 4 items per line.
- 7. We have to change directory into: /modules/search/templates/
- 8. Find this file: SearchScan.tpl – back it up!
- 9. Open this file and find line 95 which reads:
- 10. This is the start of the loop which controls the output so we have to add a line or two in here to control the output:

I’ve attached a Text file so that you can copy and paste … click to down the Gallery2 search chunk - 11. So in total you have to add a few lines in there - no problem hey?
- 12. Job done. Here’s a final screen shot:

You can view the new search function at Pure Anime Gallery
Leave us a comment about how you get on or go to PRO SEO Forums to chat to us
Tags:customisation gallery2Popularity: 14%