noherczeg / breadcrumb Goto Github PK
View Code? Open in Web Editor NEWA framework agnostic Breadcrumb management Package for PHP
Home Page: http://noherczeg.github.io/breadcrumb/
License: MIT License
A framework agnostic Breadcrumb management Package for PHP
Home Page: http://noherczeg.github.io/breadcrumb/
License: MIT License
Hi,
I came across a bug, when my url is http://domain.pl/en/2222222222222222, uri consists of only numbers. I get an error:
array_values() expects parameter 1 to be array, integer given
Location:
/vendor/noherczeg/breadcrumb/src/Noherczeg/Breadcrumb/Breadcrumb.php on line 205
I found that json_decode return Int, and this breaks array_values()
It seems that the option of a dictionary for an array is not working. And there's an option that I can use an address to the dictionary file? I tried to indicate an address but did not run.
Currently ucfirst() is used in builder.php for title casing. It seems more appropriate to use ucwords() for a title. Or at least add another option that does.
Congratulations, you made it to the trending repos page :) (At least yesterday, when I was starting to write this issue ;-)).
It would be nice if you could provide a better project description in your github repo settings, so people can get a better grasp in what your project does. A good example comes from your readme that describes your project very well: A package for breadcrumb management.
Create a breadcrumb and use the Bootstrap builder, it is missing opening LI tags for the separator and closing LI tags for the selected and unselected crumbs.
I had to swap lines 59/59 from Builders/Builder.php in order for it to generate proper url's in Laravel 4.1
$this->setNextCurrentURL($segment, $different_links);
$this->setLink($key, $segment, $position);
If i didn't do that, the url's would have been shifted by one.
This is how i did the init https://gist.github.com/CoolGoose/c50a10b2adf4676f2df1
Build is: {{ $breadcrumb->build('bootstrap', 'lower', true, '') }}
The ul class for Foundation should be changed from "breadcrumb" to "breadcrumbs" with the most up to date version of Zurb's Foundation.
Hi,
I published the config file within laravel 4
php artisan config:publish noherczeg/breadcrumb
Made some changes, but the changes don't take effect. It looks to me like you aren't ever referencing the package config file.
I was able to make it work by adding the following line to BreadCrumb\Config.php around line 47 in the value() method
if (!is_string($key)) {
throw new \InvalidArgumentException("Invalid argument provided, string required!");
}
elseif(\Config::get('breadcrumb::' . $key, false) !== false) {
return \Config::get('breadcrumb::' . $key, false);
}
// as before
Doing this and removing the namespace declaration from the generated config file worked for me but not sure what effect this would have on people using it outside of laravel
Change $this->app, to $app.
return new Breadcrumb($this->app['request']->root(), $options);
return new Breadcrumb($app['request']->root(), $options);
In Laravel 4.1, I get the breadcrumbs like this:
private function getBreadcrumbsHtml() {
$dictionary = array('test' => 't2');
$bc = new \Noherczeg\Breadcrumb\Breadcrumb(URL::to('/'), $dictionary);
$uri = Request::path();
$bc->from($uri)->append('Home', 'left', true);
return $bc->build('bootstrap', 'title', true, '/');
}
However, when I go to http://mysite.com/test the html returned shows 'test', not 't2' as it should. It does work if I use the default en.php lang file ... but I'd prefer to use the custom dictionary.
Unhandled Exception
Message:
Provided output format(foundation) is not supported!
Location:
/Users/alex/Sites/bothsider.dev/vendor/noherczeg/breadcrumb/src/Noherczeg/Breadcrumb/Breadcrumb.php on line 413
Stack Trace:
#0 /Users/alex/Sites/bothsider.dev/application/controllers/issue.php(135): Noherczeg\Breadcrumb\Breadcrumb->build('foundation')
#1 [internal function]: Issue_Controller->action_index('725', 'test-issue-2')
#2 /Users/alex/Sites/bothsider.dev/laravel/routing/controller.php(325): call_user_func_array(Array, Array)
#3 /Users/alex/Sites/bothsider.dev/laravel/routing/controller.php(285): Laravel\Routing\Controller->response('index', Array)
#4 /Users/alex/Sites/bothsider.dev/laravel/routing/controller.php(165): Laravel\Routing\Controller->execute('index', Array)
#5 /Users/alex/Sites/bothsider.dev/laravel/routing/route.php(153): Laravel\Routing\Controller::call('issue@index', Array)
#6 /Users/alex/Sites/bothsider.dev/laravel/routing/route.php(124): Laravel\Routing\Route->response()
#7 /Users/alex/Sites/bothsider.dev/laravel/laravel.php(167): Laravel\Routing\Route->call()
#8 /Users/alex/Sites/bothsider.dev/public/index.php(36): require('/Users/alex/Sit...')
#9 {main}
Given a URL like:
http://example.com/a/b
I want my HTML to be:
<a href="/">Home</a>
<a href="/a">A</a>
<a href="/a/b">B</a>
I use the following code:
$dictionary = Lang::get('breadcrumbs');
$uri = Request::path(); // returns: a/b
$bc = new \Noherczeg\Breadcrumb\Breadcrumb('/', $dictionary);
$bc->from($uri)->append('', 'left', true); // set base and append home URL
return $bc->build('bootstrap', 'title', true);
The result is:
<a href="/">Home</a>
<a href="//a">A</a>
<a href="//a/b">B</a>
How do I append a base url of '/' without causing the double slash for all other URLs?
I try to overwrite translation in segment using the way you explained however it doesn't work. Instead it creates a new segment with the translation I have defined while using append method.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.