search plugin problem
-
- Phoca Member
- Posts: 11
- Joined: 24 Feb 2009, 07:30
Re: search plugin problem
kshipra , thanks for your need..
I joint the original files..
i'have tryed many things..
when i put on line 148 phocagallery.php(in /plugins/search/)
. ' "2" AS browsernav'
. ' a.filename AS iname,'
and if i try on the frontend the search, it's show only categories results without thumbs and now,without links filename
please can help me again
if you want look the site http://www.anakaonews.com/
I joint the original files..
i'have tryed many things..
when i put on line 148 phocagallery.php(in /plugins/search/)
. ' "2" AS browsernav'
. ' a.filename AS iname,'
and if i try on the frontend the search, it's show only categories results without thumbs and now,without links filename
please can help me again
if you want look the site http://www.anakaonews.com/
-
- Phoca Member
- Posts: 41
- Joined: 27 Feb 2009, 13:08
Re: search plugin problem
Code: Select all
if ($result->browsernav == 1 ) : ?>
<a href="<?php echo JRoute::_($result->href); ?>" target="_blank">
<?php else : ?>
<a href="<?php echo JRoute::_($result->href); ?>">
<?php endif;
Code: Select all
$sitetitle= $mainframe->getCfg('sitename') ;
$v="<img src=' /".$sitetitle."/images/phocagallery/thumbs/phoca_thumb_m_".$result->iname."'>";
echo $v;
echo $this->escape($result->title);
Then check it if its working or not?
If its still not working then I"ll check it out by doing it from start by changing the original code..then i"ll let u knw....
-
- Phoca Member
- Posts: 41
- Joined: 27 Feb 2009, 13:08
Re: search plugin problem
I am attaching my file.. in which i have done many changes to display images in search result.Just check out the file and do the changes as per your requirement.
I hope this will help you.
I hope this will help you.
-
- Phoca Member
- Posts: 33
- Joined: 11 Mar 2009, 22:41
Re: search plugin problem
Thank you for posting your files kshipra,
I made the following change to the defaults_results.php
On purpose, I removed the code and changed the path to my images.
I add the 1 line to phocagallery.php, as you can see
Result of these hacks: I get a broken link for an image in the search results. When I debug the page, I can see that the image path just ends after the "/images/phocagallery/" instead of showing the path generated by the ".$result->iname." code.
Can you think of a reason why the ".$result->iname." isn't working?
On a side note:
When I use YOUR phocagallery.php file I get search results with an image but, I only get 1 search result instead of the normal 50-100 search results. The final path to the image is being generated by the .$result->iname. code. correctly. For some reason only 1 result is listed though.
I am not familiar enough with .php to figure this one out. Any ideas?
Seems like I'm so close to making this work for me....possible bamby974 as well.
Thank you!
-Cathy
I made the following change to the defaults_results.php
Code: Select all
<?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;
$v="<img src=' /images/phocagallery/".$result->iname."'>";
echo $v;
echo $this->escape($result->title);
Code: Select all
$sitetitle= $mainframe->getCfg('sitename') ;
I add the 1 line to phocagallery.php, as you can see
Code: Select all
// search picture categories
$query = 'SELECT id, a.title AS title, "" AS created,'
. ' a.description AS text,'
. ' CONCAT_WS( " / ", '.$db->Quote($section).', a.title ) AS section,'
. ' "2" AS browsernav'
. ' a.filename AS iname,'
. ' FROM #__phocagallery_categories AS a'
. ' WHERE ( a.title LIKE '.$text
. ' OR a.name LIKE '.$text
. ' OR a.description LIKE '.$text.' )'
. ' AND a.access <= '.(int) $user->get( 'aid' )
. ' GROUP BY a.id'
. ' ORDER BY '. $order
Can you think of a reason why the ".$result->iname." isn't working?
On a side note:
When I use YOUR phocagallery.php file I get search results with an image but, I only get 1 search result instead of the normal 50-100 search results. The final path to the image is being generated by the .$result->iname. code. correctly. For some reason only 1 result is listed though.
I am not familiar enough with .php to figure this one out. Any ideas?
Seems like I'm so close to making this work for me....possible bamby974 as well.
Thank you!
-Cathy
-
- Phoca Member
- Posts: 41
- Joined: 27 Feb 2009, 13:08
Re: search plugin problem
hi orangesparkz,
what I can see is that you have not used "," after "2" AS browsernav' .I have made changes in the file.Check it out.
I hope this can solve your problem
Kshipra
what I can see is that you have not used "," after "2" AS browsernav' .I have made changes in the file.Check it out.
Code: Select all
$query = 'SELECT id, a.title AS title, "" AS created,'
. ' a.description AS text,'
. ' CONCAT_WS( " / ", '.$db->Quote($section).', a.title ) AS section,'
. ' "2" AS browsernav,'
. ' a.filename AS iname'
. ' FROM #__phocagallery_categories AS a'
. ' WHERE ( a.title LIKE '.$text
. ' OR a.name LIKE '.$text
. ' OR a.description LIKE '.$text.' )'
. ' AND a.access <= '.(int) $user->get( 'aid' )
. ' GROUP BY a.id'
. ' ORDER BY '. $order
Kshipra
-
- Phoca Member
- Posts: 33
- Joined: 11 Mar 2009, 22:41
Re: search plugin problem
Hi kshipra,
Thank yo so much for responding. I tried adding the comma and it made no difference, the image path is still not generated by the .$result->iname. code added to the default_results.php page.
This is the site if you want to check it out. http://oliphantstudio.com/index.php?opt ... &Itemid=19
I do not know php. Do you? Perhaps there is another way to call the path of the image we are trying to display?
Everything seems to work great with your hacks except the path is not generated. I attached my 2 files, if you have a free moment, see if I a missing a key element or something. I wish I knew php. I am enrolled in classes this summer (too late for this!)
I really appreciate your help.
Thanks again
Thank yo so much for responding. I tried adding the comma and it made no difference, the image path is still not generated by the .$result->iname. code added to the default_results.php page.
This is the site if you want to check it out. http://oliphantstudio.com/index.php?opt ... &Itemid=19
I do not know php. Do you? Perhaps there is another way to call the path of the image we are trying to display?
Code: Select all
$v="<img src=' /images/phocagallery/".$result->iname."'>";
echo $v;
echo $this->escape($result->title);
I really appreciate your help.
Thanks again
-
- Phoca Member
- Posts: 41
- Joined: 27 Feb 2009, 13:08
Re: search plugin problem
hmm..yeah I know php ..but not much and thats not so tough you can learn it easily
About the path , yeah this can be a problem in the case , when you are creating a folder and saving images inside a folder. In this case it might create problem..as the path i have given is not a correct way... So you can change it and use it in this way...
If its still not working then try to modify it by changing the path .Anyway what is the path of the images in your case? just check out the path that result->iname is giving..is it giving the corect path where images are actually stored or it is giving the wrong path?the problem is in the above lines only so first try this method which i have given you and in case if its not working then you have to check it how you can display the exact path. I hope this time it will work
About the path , yeah this can be a problem in the case , when you are creating a folder and saving images inside a folder. In this case it might create problem..as the path i have given is not a correct way... So you can change it and use it in this way...
Code: Select all
$res = pathinfo($result->iname);
$imagepath="<img src=' /".$sitetitle."/images/phocagallery/".$res['dirname']. "\n"."/thumbs/phoca_thumb_m_".$res['basename']. "\n"."'>";
echo $imagepath;
-
- Phoca Member
- Posts: 33
- Joined: 11 Mar 2009, 22:41
Re: search plugin problem
Thanks for the looking into this with me. You're very nice for helping!
I think I wasn't clear enough. Using this code:
It's not that the image path is broken, it's incomplete. The php code .$result->iname. doesn't do anything. When I use the above code I get this html output:
See how there's nothing after images/phocgallery/ ?
strang, huh?
If I manually type in the rest of the path (using firebug) so it looks like this:
Then it works great, image is displayed.
So I need the php function or command to generate that remaining part of the path, but I do not know how
Oh, BTW I tried the other code you gave me and the php in the path also didn't do anything just like the above code. Am I missing something!? Well obviously I am!
Here's the html it generated:
Thanks again,
orangesparkz
I think I wasn't clear enough. Using this code:
Code: Select all
$v="<img src=' /images/phocagallery/".$result->iname."'>";
echo $v;
echo $this->escape($result->title);
Code: Select all
<a href="/index.php?option=com_phocagallery&view=category&id=53:spring-summer">
<img src="/images/phocagallery/"/>
Spring & Summer: 8
</a>
strang, huh?
If I manually type in the rest of the path (using firebug) so it looks like this:
Code: Select all
<a href="/index.php?option=com_phocagallery&view=category&id=53:spring-summer">
<img src="/images/phocagallery/landscapes/spring_summer/thumbs/phoca_thumb_m_008.jpg"/>
Spring & Summer: 8
</a>
So I need the php function or command to generate that remaining part of the path, but I do not know how
Oh, BTW I tried the other code you gave me and the php in the path also didn't do anything just like the above code. Am I missing something!? Well obviously I am!
Here's the html it generated:
Code: Select all
<a href="/index.php?option=com_phocagallery&view=category&id=53:spring-summer">
<img src="//images/phocagallery/ /thumbs/phoca_thumb_m_"/>
</a>
orangesparkz
-
- Phoca Member
- Posts: 41
- Joined: 27 Feb 2009, 13:08
Re: search plugin problem
hi orangesparkz ,
Thanx even m not getting why this is not working it should work. hmm I think porblem is not with the image tag..problem is with the database query. There is something worng with the query....
ohh i got somethng ....This was the original code
and this one is yours
Now see the difference there are some lines missing ... you need to perform the left join but still result->iname should give the proper filename.. just try to print the result->iname and check whether it is giving the correct filename of the images and compare the result of iname with the database. Field filename in the database and iname should be same if the query is correct otherwise you need to correct this query. if query is correct then it should return the correct path of the filename as in the database
Thanx even m not getting why this is not working it should work. hmm I think porblem is not with the image tag..problem is with the database query. There is something worng with the query....
ohh i got somethng ....This was the original code
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(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'
. ' 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'
. ' AND b.access <= '.(int) $user->get( 'aid' )
. ' ORDER BY '. $order
;
Code: Select all
// search picture categories
$query = 'SELECT id, a.title AS title, "" AS created,'
. ' a.description AS text,'
. ' CONCAT_WS( " / ", '.$db->Quote($section).', a.title ) AS section,'
. ' "2" AS browsernav'
. ' a.filename AS iname,'
. ' FROM #__phocagallery_categories AS a'
. ' WHERE ( a.title LIKE '.$text
. ' OR a.name LIKE '.$text
. ' OR a.description LIKE '.$text.' )'
. ' AND a.access <= '.(int) $user->get( 'aid' )
. ' GROUP BY a.id'
. ' ORDER BY '. $order
Code: Select all
' FROM #__phocagallery AS a'
. ' LEFT JOIN #__phocagallery_categories AS b ON b.id = a.catid'
-
- Phoca Member
- Posts: 33
- Joined: 11 Mar 2009, 22:41
Re: search plugin problem
Let me first start out by saying I GOT IT TO WORK!
But not after a lot of trial and error. I used some of your code kshipra and modified other code. I know I couldn't explain all the changes I made, and some things I did created other problems. I'm sure knowing php would help I will attach my files in case it helps anyone to get their site to display images with search results and to figure out these last two problems and share with everyone.
Couple problems.
First, the search results are limited to 50. Any ideas what is keeping it at this limit? Before I got the images to display with the results, I was getting search results over 50 results for many searches.
I had already changed the code on phocagallery.php and phocagallery.xml , but it still is a limit of 50.
Second, I need is to add php code that will generate the Itemid for the image link.
For example:
if I click on a image from the results, it goes to the category page that contains it, the URL is:
index.php?option=com_phocagallery&view=category&id=53:spring-summer
BUT it needs to be this:
index.php?option=com_phocagallery&view=category&id=53:spring-summer&Itemid=5
I need php code that will generate the itemid and tack it on to the URL for the image link. I think it would be added to the end of this line (180-181)
Lastly, and least important, the results used to show the categories that the images came from, now they don't. I'm not sure which line of code does that, but I either disabled it or something. Any ideas which line display that?
Thanks so much. Much progress today!!!
-orangesparkz
But not after a lot of trial and error. I used some of your code kshipra and modified other code. I know I couldn't explain all the changes I made, and some things I did created other problems. I'm sure knowing php would help I will attach my files in case it helps anyone to get their site to display images with search results and to figure out these last two problems and share with everyone.
Couple problems.
First, the search results are limited to 50. Any ideas what is keeping it at this limit? Before I got the images to display with the results, I was getting search results over 50 results for many searches.
I had already changed the code on phocagallery.php and phocagallery.xml , but it still is a limit of 50.
Code: Select all
$limit = $pluginParams->def( 'search_limit', 200 );
For example:
if I click on a image from the results, it goes to the category page that contains it, the URL is:
index.php?option=com_phocagallery&view=category&id=53:spring-summer
BUT it needs to be this:
index.php?option=com_phocagallery&view=category&id=53:spring-summer&Itemid=5
I need php code that will generate the itemid and tack it on to the URL for the image link. I think it would be added to the end of this line (180-181)
Code: Select all
foreach($list1 as $key => $item) {
$list1[$key]->href = JRoute::_('index.php?option=com_phocagallery&view=category&id='.$item->catslug );
Thanks so much. Much progress today!!!
-orangesparkz