search plugin problem

Phoca plugins - support for all Phoca plugins except Phoca Gallery plugins
kshipra
Phoca Member
Phoca Member
Posts: 41
Joined: 27 Feb 2009, 13:08

search plugin problem

Post by kshipra »

I am using search plugin in my gallery and my problem is that when i search for image it is providing with the link instead of image. I want my search plugin to display the image in that page instead of link... I am not able to do this :( .. Can anyone help me.. I need help.. :( any help will solve my this biggest problem... :(

Thanx in advance
kshipra
Phoca Member
Phoca Member
Posts: 41
Joined: 27 Feb 2009, 13:08

Re: search plugin problem

Post by kshipra »

anyone plzzzzzzzzzzzzz?
why no one is answering to my question..plz atleast a hint what a I need to do :(
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: search plugin problem

Post by Jan »

Hi, there is no such option, this need to be customized in plugin code :-(
If you find Phoca extensions useful, please support the project
kshipra
Phoca Member
Phoca Member
Posts: 41
Joined: 27 Feb 2009, 13:08

Re: search plugin problem

Post by kshipra »

Hi Jan,
Thanx for replying my question.. After playing with that plugin I was able to customize the plugin and was able to display the images :)
bamby974
Phoca Member
Phoca Member
Posts: 11
Joined: 24 Feb 2009, 07:30

Re: search plugin problem

Post by bamby974 »

Please can you share the solution?

Thank's a lot
kshipra
Phoca Member
Phoca Member
Posts: 41
Joined: 27 Feb 2009, 13:08

Re: search plugin problem

Post by kshipra »

yeah sure ! :) You want to display images instead of link right?
go to ./plugins/search/phocagallery.php . Change the select query(for images) which you can find near abt at line no 155. In this select query filename is not selected so just add this line "a.filename as fname". Then go to /components/com_search/views/search/tmpl/default_results.php and write the below lines in default_results.php

Code: Select all

$sitetitle= $mainframe->getCfg('sitename') ;
                            $v="<img src=' /".$sitetitle."/images/phocagallery/thumbs/phoca_thumb_m_".$result->iname."'>";
                            echo $v;
I hope this will help you in displaying images :)
bamby974
Phoca Member
Phoca Member
Posts: 11
Joined: 24 Feb 2009, 07:30

Please can you explain more

Post by bamby974 »

kshipra,

Please can you explain more:

i'hav tried many position with your code..i'm not a expert. :idea:
where i put this "a.filename as fname"

i put here LINE 155 on phocagallery.php ?

a.filename as fname
. ' AND b.access <= '.(int) $user->get( 'aid' )
. ' ORDER BY '. $order

or
. ' a.filename as fname,'
. ' AND b.access <= '.(int) $user->get( 'aid' )
. ' ORDER BY '. $order

and for default_results.php , where is the line to paste this ?:

$sitetitle= $mainframe->getCfg('sitename') ;
$v="<img src=' /".$sitetitle."/images/phocagallery/thumbs/phoca_thumb_m_".$result->iname."'>";
echo $v;

Thank a lot ,kshipra
kshipra
Phoca Member
Phoca Member
Posts: 41
Joined: 27 Feb 2009, 13:08

Re: search plugin problem

Post by kshipra »

Even I am not an expert , I am also new to phoca :) I jut did hit and trial and luckily my hit worked. So I dont knw whether it will work for you or not :( but it worked for me. I"ll tell you what I did. but you also have to do hit and trial so that you can customize it according to your need.

The bold one is the line that i have added. you can check it from the original query and u can see the changes that i have made. I have commented few statments from the original one as i dont need that statments

Code: Select all

$query  = 'SELECT '
    . ' CASE WHEN CHAR_LENGTH(a.title) THEN CONCAT_WS(\': \', b.title, a.title)
ELSE b.title END AS title, '
    . ' CASE WHEN CHAR_LENGTH(a.description) THEN CONCAT_WS(\': \', a.title,a.description) ELSE a.title END AS text, '
    . ' a.date AS created, '
     . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
     //. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
    . ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END AS catslug, '
    . ' CONCAT_WS( " / ", '.$db->Quote($section).', a.title ) AS section,'
    . ' "2" AS browsernav'
     [b]. ' a.filename AS iname,'[/b]
      . ' FROM #__phocagallery AS a'
    . ' LEFT JOIN #__phocagallery_categories AS b ON b.id = a.catid'
    . ' WHERE ( a.title LIKE '.$text
    . ' OR a.filename LIKE '.$text
    . ' OR a.description LIKE '.$text.' )'
    . ' AND a.published = 1'
    . ' AND b.published = 1'
    . ' ORDER BY '. $order
    ;
bamby974 wrote:$sitetitle= $mainframe->getCfg('sitename') ;
$v="<img src=' /".$sitetitle."/images/phocagallery/thumbs/phoca_thumb_m_".$result->iname."'>";
echo $v;
YTou can paste these line after line 18 0r 19(ac to my editor) I hopw it will now work :) I hope this will help you
bamby974
Phoca Member
Phoca Member
Posts: 11
Joined: 24 Feb 2009, 07:30

Re: search plugin problem

Post by bamby974 »

Hello kshipra,

thank's for help.

this dont work for me..that's fine?


<?php if ( $result->href ) :
if ($result->browsernav == 1 ) : ?>
<a href="<?php echo JRoute::_($result->href); ?>" target="_blank">
<?php else : ?>
<a href="<?php echo JRoute::_($result->href); ?>">

<?php endif;
$sitetitle= $mainframe->getCfg('sitename') ;
$v="<img src=' /".$sitetitle."/images/phocagallery/thumbs/phoca_thumb_m_".$result->iname."'>";
echo $v;
echo $this->escape($result->title);

thanks a lot
kshipra
Phoca Member
Phoca Member
Posts: 41
Joined: 27 Feb 2009, 13:08

Re: search plugin problem

Post by kshipra »

Is it not working? but i think it should work.. Ok fyn do one thing..(just a trial).
bamby974 wrote:<?php if ( $result->href ) :
if ($result->browsernav == 1 ) : ?>
<a href="<?php echo JRoute::_($result->href); ?>" target="_blank">
<?php else : ?>
<a href="<?php echo JRoute::_($result->href); ?>">
comment this whole part and simply compile this one
bamby974 wrote:$sitetitle= $mainframe->getCfg('sitename') ;
$v="<img src=' /".$sitetitle."/images/phocagallery/thumbs/phoca_thumb_m_".$result->iname."'>";
echo $v;
echo $this->escape($result->title);
And see if its working or not?
I dont have the original code so i cant test it. I have the code which is totally different from the original one so I amnot able to check :( thts why i am saying u can do hit and trail...
Post Reply