Get nice urls from titles

I got this code:

 href="<?php echo $menu->title()->lower()->html() ?>-<?php echo $category->title()->lower()->html() ?>"

which outputs the following:

href="restaurant-american steakhouse"

How do I solve the empty space in the output?

This looks awesome, unfortunattly it doesn’t work:

You can use str::slug() to turn the space into a dash, if that’s what you want to achieve.

 href="<?php echo $menu->title()->lower()->html() ?>-<?php echo str::slug($category->title()->lower()->html()) ?>"
1 Like

Exactly what I’m looking for :slight_smile:

Thanks (again) @texnixe

1 Like