- Posts: 6
COMMUNITY FORUM
Images in search results
- jjozsika
- Offline
- New Member
Less
More
13 years 7 months ago #93519
by jjozsika
Replied by jjozsika on topic Images in search results
Your Welcome :)
Mark Foster said:
You are a star :)
Works great, been waiting weeks to find a solution to that :)
Thank you so much
Mark Foster said:
You are a star :)
Works great, been waiting weeks to find a solution to that :)
Thank you so much
Please Log in or Create an account to join the conversation.
- Emily Pearce
- Offline
- Junior Member
Less
More
- Posts: 24
13 years 7 months ago #93520
by Emily Pearce
Replied by Emily Pearce on topic Images in search results
Thanks so much for this solution...working perfectly :)
I would also like to include an items extra fields in the Joomla search results.
Any idea how i might do this?
Many thanks, Emily
I would also like to include an items extra fields in the Joomla search results.
Any idea how i might do this?
Many thanks, Emily
Please Log in or Create an account to join the conversation.
- jjozsika
- Offline
- New Member
Less
More
- Posts: 6
13 years 7 months ago #93521
by jjozsika
Replied by jjozsika on topic Images in search results
You saw where i added the extra field to the main query. There you can prepare extra variables. (i had to add the images to the results only).
Please Log in or Create an account to join the conversation.
- Liam McGarry
- Offline
- New Member
Less
More
- Posts: 3
13 years 6 months ago #93522
by Liam McGarry
Replied by Liam McGarry on topic Images in search results
Hi There,
I've signed up to say a massive thank you to jjozsika who solved the exact same problem that I had!
For anyone who may be stuggling to find the default_results.php file, it can be found in different locations, mine was:
components/com_search/views/search/tmpl
Also, whilst on the topic of searching, does anyone know how to modify the search results screen?
I.e Remove:
Search Keyword: SearchAll words Any words Exact PhraseSearch Only:Activities Other group
I too am using K2 search filter
I've signed up to say a massive thank you to jjozsika who solved the exact same problem that I had!
For anyone who may be stuggling to find the default_results.php file, it can be found in different locations, mine was:
components/com_search/views/search/tmpl
Also, whilst on the topic of searching, does anyone know how to modify the search results screen?
I.e Remove:
Search Keyword: SearchAll words Any words Exact PhraseSearch Only:Activities Other group
I too am using K2 search filter
Please Log in or Create an account to join the conversation.
- Francisco Ferreira
- Offline
- Junior Member
Less
More
- Posts: 28
13 years 4 months ago #93523
by Francisco Ferreira
Replied by Francisco Ferreira on topic Images in search results
Ok,
Many thanks jjozika.
We now know how to put images on search results. Nonetheless It would be the ultimate help if you or someone could explain us newbies how to do the same with other extra fields, i.e. I understand we just need to put the field name like: $query = " SELECT i.id, i.title, i.metadesc,
... but I'm not so clear about what to put on the default_results.php ?
Can you help us please?
Many thanks in advance...
Francis
ps: Why would JA guys make the dificult part only to en up before developing the easyer part, i.e. costumizable results display...
Many thanks jjozika.
We now know how to put images on search results. Nonetheless It would be the ultimate help if you or someone could explain us newbies how to do the same with other extra fields, i.e. I understand we just need to put the field name like: $query = " SELECT i.id, i.title, i.metadesc,
... but I'm not so clear about what to put on the default_results.php ?
Can you help us please?
Many thanks in advance...
Francis
ps: Why would JA guys make the dificult part only to en up before developing the easyer part, i.e. costumizable results display...
Please Log in or Create an account to join the conversation.
- Brenda
- Offline
- New Member
Less
More
- Posts: 13
13 years 4 months ago #93524
by Brenda
Replied by Brenda on topic Images in search results
How do you add images to search if you are just using K2 Tools Search and not Joomlart?
Please Log in or Create an account to join the conversation.
- Brenda
- Offline
- New Member
Less
More
- Posts: 13
13 years 4 months ago #93525
by Brenda
Replied by Brenda on topic Images in search results
Nevermind, I figured it out:
In this file: /plugins/search/k2.php
add the id to the SELECT query (It has the SQL query with binary search, you have to add the id field to the selected list:
add the id field name):
$query = " SELECT i.id, i.title, i.metadesc,
In this file: /components/com_search/views/search/tmpl/default_results.php
AFTER THIS SECTION(or where you want to position the image) :
if ( $result->section ) : ?><br /><span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">(<?php echo $this->escape($result->section); ?>)</span><?php endif; ?><?php endif; ?></div>
ADD THIS:
<?php $row = './media/k2/items/cache/'.md5("Image".$result->id).'_S.jpg'; if(file_exists($row)) echo "<img src=\"$row\">"; ?>
In this file: /plugins/search/k2.php
add the id to the SELECT query (It has the SQL query with binary search, you have to add the id field to the selected list:
add the id field name):
$query = " SELECT i.id, i.title, i.metadesc,
In this file: /components/com_search/views/search/tmpl/default_results.php
AFTER THIS SECTION(or where you want to position the image) :
if ( $result->section ) : ?><br /><span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">(<?php echo $this->escape($result->section); ?>)</span><?php endif; ?><?php endif; ?></div>
ADD THIS:
<?php $row = './media/k2/items/cache/'.md5("Image".$result->id).'_S.jpg'; if(file_exists($row)) echo "<img src=\"$row\">"; ?>
Please Log in or Create an account to join the conversation.
- Jock
- Offline
- Premium Member
Less
More
- Posts: 90
13 years 3 months ago #93526
by Jock
Replied by Jock on topic Images in search results
Hi,
This is kind of related but not entirely the same ... does anyone know how you return $result->text; for extra fields? Basically I want my search results to have the snippet of text with the highlighted keywords for content that is in extra fields. Currently it is returning the matching item but not with the snippet.
Anyone know how to fix this?
This is kind of related but not entirely the same ... does anyone know how you return $result->text; for extra fields? Basically I want my search results to have the snippet of text with the highlighted keywords for content that is in extra fields. Currently it is returning the matching item but not with the snippet.
Anyone know how to fix this?
Please Log in or Create an account to join the conversation.
- Sotiris
- Offline
- New Member
Less
More
- Posts: 6
13 years 3 months ago #93527
by Sotiris
Replied by Sotiris on topic Images in search results
and i try to find how i can show extra fields value in search result...
Anyone know how i can do it?
Anyone know how i can do it?
Please Log in or Create an account to join the conversation.
- Jock
- Offline
- Premium Member
Less
More
- Posts: 90
13 years 3 months ago #93528
by Jock
Replied by Jock on topic Images in search results
I am struggling to find a solution Sotrek. Really not sure why it wouldn't work when it returns the item but no snippet?
Please Log in or Create an account to join the conversation.