search navigation

Permalink
hi, could someone please help me,

im searching for a way to add a breadercrubmb in search results that will show in every result in which location are the page result

thank you.

 
jelthure replied on at Permalink Reply
jelthure
are you using the standard search block? if so you'll need to modify the view (or create a new template) to hard code in an autonav block. Here's an example, you would put this inside of the foreach statement:

$bt = BlockType::getByHandle('autonav');
$bt->controller->setCollectionObject($r);
$bt->controller->displayPages = 'top';
$bt->controller->displaySubPages = 'relevant_breadcrumb';
$bt->render('templates/breadcrumb');


Note: I haven't tested this but in theory it should work for you.
psycasso replied on at Permalink Reply
sorry, not working.

maybe im not put the code in the right place,

whare to post the code and whare i told him show me the var
jordanlev replied on at Permalink Reply
jordanlev
I don't think this is what you're asking for -- you want the breadcrumb trail to show up for every search result, right?

In that case you need to create a custom template for the search block and put some custom code in there:

1) Create a new directory on your server at YOURSITE/blocks/search/

2) Copy YOURSITE/concrete/blocks/search/view.php to that new directory you made (so the new copy is at YOURSITE/blocks/search/view.php)

3) Edit that new copy of the file and make these changes:

Around line #24, just below this line:
$tt = Loader::helper('text');

add this line:
$nh = Loader::helper('navigation');


And, around line #37 or 38, replace this code:
<span class="pageLink"><?php  echo $this->controller->highlightedMarkup($r->getPath(),$query)?></span>

with this code:
<span class="pageLink">
<?php
$parents = array_reverse($nh->getTrailToCollection(Page::getByID($r->getID())));
$breadcrumbs = array();
foreach ($parents as $p) {
   $breadcrumbs[] = '<a href="' . $nh->getLinkToCollection($p) . '">' . $p->getCollectionName() . '</a>';
}
echo implode(' &gt; ', $breadcrumbs);
?>
</span>
psycasso replied on at Permalink Best Answer Reply
hi jordan, first of all thanks,


second yes its what i needed

and three, sadley its not working its give me the next error:


[code]tal error: Call to a member function getLinkToCollection() on a non-object in /home/btihost/domains/g2u.co.il/public_html/blocks/search/view.php on line 46[\code]
jordanlev replied on at Permalink Reply
jordanlev
Oops, sorry, that should be "$nh->getLinkToCollection($p)" (not "$ni->getLinkToCollection($p)") -- replace $ni with $nh.

(I've since corrected my sample code in the previous comment)
psycasso replied on at Permalink Reply
thank you very much!! is great!

maybe you could tell thare is a way to make to look better and inside a frame (not iframe) that will be a scroller but the template remain the same (like iframe)
jordanlev replied on at Permalink Reply
jordanlev
Sorry, I'm not sure what you mean. What exactly do you want to look better? How do you want it to look?
psycasso replied on at Permalink Reply
jordan leave the design part i wil css it,

but if thare is way to put it in a "iframe" or something similar to that, because i want the template will not move and it will be inside a box or something i dont know how to do it if you could help me with that i will be glad
psycasso replied on at Permalink Reply
yep, works great!!!

sorry to Bother you but thare is a serious problem in my site with jumping objects and i post few hours ago it seems to be you know the system well you have any idea for the reason?


http://www.concrete5.org/community/forums/usage/hi-jumping-problems...
boomgraphics replied on at Permalink Reply
boomgraphics
'like iframe but not" sounds like simply outputting this code into a div with a set height and width, and then setting the div overflow to auto in your css. This would give you a scrolling "frame", and you could even find some javascript to allow you to use a custom designed scrollbar. Hope it helps! :-)