Welcome Guest, Not a member yet? Register   Sign In
Autocrumb - Lightweight Breadcrumb Helper (ver.12.05.1)
#21

[eluser]ardinotow[/eluser]
@123wesweat.
In last version autocrumb will stop finding any link name that contain a number. That's why you cannot see "hiring-a-plumber-4" in crumb result. But if you use
Code:
if (preg_match("/^([0-9|a-z_-])+$/i", $value))
it should fine as long as you set url suffix in your application/config folder
Code:
$config['url_suffix'] = ".html";
Another way to solved this problems is by download Autocrumb ver.2.0.0 below :coolsmile:
#22

[eluser]ardinotow[/eluser]
** Autocrumb | Breadcrumb Helper 2.0.0 **

New Features:
1. Hide or show numbers in crumbs result.

$config['hide_number'] = TRUE;

If set to TRUE then any number without a word in a segment will be hide.
Example: mysite.com/blog/2009/08/7-habbits/
will have breadcrumbs: Home > Blog > 7 Habbits
Otherwise if set to FALSE it will produce: Home > Blog > 2009 > 08 > 7 Habbits
Notes: If the last segment is a number then it always shown whether this config
set to TRUE or FALSE.

2. Minor bug fixes: removes trailing slash from last segment.

Regards,
Ardinoto Wahono

PS:
- Open helpers/breadcrumb_helper.php to see installation guides.
- Configuration with detail descriptions is store in config/breadcrumb.php.
#23

[eluser]123wesweat[/eluser]
@ardinotw, still a question about the last crumb

how can i make domain.com/artwork/street/bansky-tray-300.html

look like
Home >> artwork >> street >> banksy tray
in the breadcrumbs

Now it looks like
Home >> Artwork >> Street >> Banksy Tray 300 Html


But i like to keep domain.com/artwork/street/all/25
domain.com/artwork/street/all/50

for navigation

home >> artwork >> street >> all >> 25

home >> artwork >> street >> all >> 50
something like this
Code:
$lastcrumb= str_replace("html", "", $lastcrumb);
            
           $lastcrumb= ereg_replace("[0-9]", "", $lastcrumb);
#24

[eluser]ardinotow[/eluser]
@123wesweat,
For html file extension problem, you can add these into config/breadcrumb.php
Code:
$config['strip_characters'] = array ('_', '-', '.html', '.php');
All characters in array will be stripped from breadcrumb.
Also make this revision to helpers/breadcrumb_helper.php
Code:
$char_to_replace = $CI->config->item('strip_characters');
Last segment in the url always shown even if it contain only number. So you can get home >> artwork >> street >> all >> 25 without any hacks.

FYI, ereg_replace is deprecated and not supported on newer version of PHP.

In domain.com/artwork/street/bansky-tray-300.html, is 300 a static or dynamic value? Why you put 300 in a last crumb and why you need to remove it? I want to generalized the problem before make a troubleshooting for your problem.
#25

[eluser]123wesweat[/eluser]
@ardinotow, tx for your fast handling i will try your suggestions.

About domain.com/artwork/street/bansky-tray-300.html,
300 is an unique dynamic value which i used in a form. I just want the breadcrumb look pretty and informative.
#26

[eluser]123wesweat[/eluser]
@ardinotow,

not there yet. Your suggestion didn't work

i config i have added
Code:
$config['strip_characters'] = array ('_', '-', '.html', '.php', 'html');
adding html did strip html from the bread crumb
but 300 still stays, so now i have
Code:
Home Artwork Street Bansky Tray 300

and is still like to get
Code:
Home Artwork Street Bansky Tray

breadcrumb_helper from line 162
Code:
foreach ($uri_array as $value)
        {
            if ($i > 0)
            {
                $segment .= $uri_array_original[$i].'/';

                // Skip link if replace value is null
                if (! in_array($i, $skip_key))
                {
                    // Auto link make over
                    if (strpos($value, "_") OR strpos($value, "-"))
                    {
                        //edit 20 feb
                        //$char_to_replace = array ('_', '-');
                        $char_to_replace = $CI->config->item('strip_characters');
                        $value = ucwords(strtolower(str_replace($char_to_replace, " ", $value)));
                    }
                    
                    // Unlink last segment (optional)
                    if ($i == $number_array-1 && $CI->config->item('unlink_last_segment'))
                    {
                        $str .= $delimiter.$wrapper_inline[0].ucwords($value).$wrapper_inline[1];
                        break;
                    }
                    $str .= $delimiter.$wrapper_inline[0].anchor($segment, ucwords($value)).$wrapper_inline[1];
                }
            }
            $i++;
        }
#27

[eluser]ardinotow[/eluser]
@123wesweat
Yeah, I know that 300 will stays unless you stated in $config['strip_characters'] something like
Code:
$config['strip_characters'] = array ('_', '-', '.html', '.php', 'html', '300');

But as 300 is not a static value you will have a lot of stripped characters to covers all dynamic numbers.

So, I want to know which one is unique value for your case, is the whole "bansky-tray-300" a unique or just "300" is a unique? Sorry I asked you a lot Smile
#28

[eluser]123wesweat[/eluser]
haha, you don't ask a lot but i do.

and i am thinking about your question and i think 300 is the one that's certainly unique.

As the 300 represents a reference number which is unique.
#29

[eluser]ardinotow[/eluser]
@123wesweat
If 300 is the only unique, you can modify the url to: domain.com/artwork/street/300/bansky-tray.html or maybe domain.com/artwork/street/bansky-tray/300.html. It's more easy to read and more common to use in codeigniter.
#30

[eluser]123wesweat[/eluser]
hmm, then i need to redo the post slugs, currently already being parsed.

can't i use a hack like if -[numeric].html don't show in breadcrumb.

if /numeric do show (as for the pagination)

sorry for all the trouble




Theme © iAndrew 2016 - Forum software by © MyBB