type in your query to search makeyougohmm
Things that ... make you go hmmtechnology music video art news reviews and muse on the web

April 17, 2004

Pivot hack: how to display images in search results

default — by TDavid @ 1:07 pm PST
New! F = please no more posts like thisD = not among your best stuffC = average postB = good post, I liked itA = great post, please create more like this (Hmm, no ratings yet)
Loading ... Loading ...

To include images in the titles of blog posts using Pivot requires hacking the source code because the pivot source code is including a wordwrap function around the title that cuts off the words at 40 characters (I turned the color red so you could see where the number would need to be increased). You could extend the wordwrap number to be a larger number so that most strings don’t wrap or just remove the wordwrap function (which is what I’m showing you how to do below).

 

Here is what you need to do:

 

STEP 1. download the file /pivot/modules/module_search.php in ASCII mode and backup this file before continuing. If you make a mistake then all you have to do is upload the old one back.

STEP 2. open with a text editor and scroll down to LINE 288:

 

Replace this line of code:

    $output .= “<li><!– “. $entry[’code’].” –><a href=’” . $link . “‘>” . wordwrap($entry[’title’], 40, ” “, 1) . “</a><br /></li>\n”;

 

WITH THIS:

/* $output .= “<li><!– “. $entry[’code’].” –><a href=’” . $link . “‘>” . wordwrap($entry[’title’], 40, ” “, 1) . “</a><br /></li>\n”;

 

HACK for images in search results 4/17/04

*/

 

$output .= “<li><!– “. $entry[’code’].” –><a href=’” . $link . “‘>” . $entry[’title’] . “</a><br /></li>\n”;

 

STEP 3. If you want to have a different URL for the image then the blog entry and no border for the image then you need to edit your blog entry title to include a closing < /a> tag and to have a border=0 inside the IMG code.

 

NOTE: see how the code in step #2 automatically embeds the closing A tag. Make sure to leave the last A in your images open or you’ll have broken HTML.

 

STEP 4. FTP changed module_search.php file over the top of the old file in ASCII mode an voila! You should be able to include images in the titles of blog entries with individual links.

 

Happy coding to you!

Related Posts

RSS Feed comments for this post No Comments »

Did this make you go hmm?
TrackBack URI: http://www.makeyougohmm.com/20040417/696/trackback/

Leave a comment


By leaving a comment you consent to the Official Hmm Comment Policy

Return Home


Copyright 2003-2008 KMR Enterprises All Rights Reserved