Hallo, Can someone help me?
i would like to make simple static website, i created menu using routers, i would like to make the url www.mywebsite.com/gallery/berl... or www.mywebsite.com/gallery/new-...
in routers i created like this:
Route::get('/gallery/berlin', function() { return View::make('pages. berlin'); });
Route::get('/gallery/new-york', function() { return View::make('pages. new-york'); });
but when i'm in www.mywebsite.com/gallery/berl... i can't go back to home or about us, the menu automatic www.mywebsite.com/gallery/ or www.mywebsite.com/gallery/abou...
can you help me please, how to make that?
Thank you
Regards wiyono
do you have Route's for Home and About us?
can you paste and post your routes.php here? (http://bin.laravel.io)
regarding your routes, this might be better
Route::get('gallery/{city}', function($city) {
$cities = array('berlin', 'new-york');
if(in_array($city, $cities)) {
return View::make('gallery' . $city);
} else {
return View::make('gallery.error', array('message' => 'City ' . $city . ' not found'));
}
});
Hallo Zenry,
thank you for your answer, i just change the menu from like this:
<li><a href="{{('/')}}">Home</a></li>
<li><a href="{{('gallery')}}">Gallery</a></li>
<li><a href="{{('gallery/berlin')}}">Berlin</a></li>
into like this and work perfect.
{{ HTML::link('/', 'Home')}}
{{ HTML::link('/gallery', 'Gallery')}}
{{ HTML::link('/gallery/berlin', 'Berlin')}}
The first menu i muss put base url in header then work.
My routers is like this:
Route::get('gallery', function() {
$title = "Gallery";
return View::make('seiten.gallery')
->with ('title', $title);
});
Route::get('gallery/berlin', function() {
$title = "Gallery - Berlin";
return View::make('seiten.berlin')
->with ('title', $title);
});
Thank you
Is that possible to use link like the first without base url, or put base url not in header? in router maybe?
Regards Wiyono
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community