Skip to main content

We have search box on the blog!

Jose CerrejonAbout 1 minGeneralDeveloperGeneralDeveloper

We have search box on the blog!

lupa
lupa

We exceeded the 60,000 views!

This is my gift for your confidence 😃

If you see the top right of the blog, you can find a search box in which you can input any word or phrase related with the blog. Examples: gpio, pimame, retropie,...

As always, my sin is the perfectionism in the code and in my eagerness to learn more, I wanted something that did not overload the blog and make experiments with other things that I comment below.


[The Beginning]

The first thing I thought was to use a search widget from Google. But it does not get along with sites in several languages, and the outcome is never as customizable as one would like, so I took the long way: Develop it from scratch.

[Design]

I'm not very good at designing, so I found online the search box in webdesignerwall.comopen in new window. It's made with CSS3 and if your browser is not compatible, it show a clear search box instead of having rounded borders.

[Javascript]

I Likes jQuery and I use it day to day. But I want to avoid using it, as after all one of my goals is to learn. Overloading the blog with a library that internally has not uses just not worth it. It's dynamically loaded when you need to display a larger image (only if necessary). The typical lightbox when you click on a screenshot, but I hope eradicate jQuery in the future, as it was a quick fix at the time.

For the rest, a bit of code to make the request to the server and displayed in a modal label the result.

The modal popup is a project called picomodalopen in new window and occupies 1,754 bytes.

[PHP]

Collect the information, filter it to prevent SQL injections among others and I use for the first time a distributed object caching for the results obtained from the database, which I hope to gradually incorporate in other petitions. It's called phpfastcacheopen in new window and it has been already commented here.

[Conclusion]

Sorry If I lost my time with this, but the result is a search engine that don't overloads the web and displays headlines in less than a second.

winking
winking