Posted by admin on November 21st, 2009 |
0 comments
Here’s a little how-to I discovered a few months ago while I was working on SimcoeDining.com and realized that Google was indexing a whole lot of mostly blank pages.
To solve this, I figured I’d better put a no-index on those pages fast; after mucking around with CakePHP’s html->meta handler (because I wanted the meta tag in the header where it belonged) and not finding anything, I came up with:
-
$html->meta('robots', null, array('name' => 'robots', 'content' => 'noindex') ,false);
BTW: The pages where empty at the time because there wasn’t a lot of data in the system, so a lot of searches where coming up empty- that’s been “fixed” now too.
Hopefully this saves someone else 20 minutes
cakephp . simcoedining
Posted by admin on November 10th, 2009 |
0 comments
A few years back my company was writing a search engine for a Toronto restaurant directory. The search used tag-words to search for venues. Every time a search was done, venues where assigned a score based on how relevant there where to the tags being searched for. Now after the score was calculated, I ended up with a list of venues ordered by their score.
Now the messy part…
In oder to display these in a list, the venues had to be pulled out and listed in that order; as well, if there was more than 40 venues, they had to be split and displayed on two or more pages. In the end, it turned out the quickest way to write it was to query MySQL for each venue one at a time. Needless-to-say not an optimum solution.
…and the right way- 4 years later
When this came up last summer during the re-write of SimcoeDining.com, I figured there there had to be a proper way of solving that problem, and I found one in Imthiaz’s blog entry:
-
ORDER BY FIELD(Venues,13,22,42,1,11)
See with MySQL (at least since v5) lets you specify a field and values to sort them by which nicely fits into CakePHP’s Paginator too.