single_page dashboard redirects
Permalink 2 users found helpful
Im creating some dashboard pages and we wondering how to do it like you.
In the dashboard there are links to category pages these all link to the first child eg.
Click on "files"
index.php/dashboard/files/ redirects index.php/dashboard/files/search/
Click on "Reports"
index.php/dashboard/reports/ redirects index.php/dashboard/reports/statistics/
when i create the new single page /dashboard/category/testpage
I get 2 new single pages in the sitemap "category" and "category/testpage"
When i click on the link to the "category" the page is blank.
So do i use a 301 to do this what do you think
thanks
In the dashboard there are links to category pages these all link to the first child eg.
Click on "files"
index.php/dashboard/files/ redirects index.php/dashboard/files/search/
Click on "Reports"
index.php/dashboard/reports/ redirects index.php/dashboard/reports/statistics/
when i create the new single page /dashboard/category/testpage
I get 2 new single pages in the sitemap "category" and "category/testpage"
When i click on the link to the "category" the page is blank.
So do i use a 301 to do this what do you think
thanks
put something like this in the controller you don't really need:
Marked this as best answer, but I'll elaborate a bit.
If you look at some of the core concrete5, namely controllers/dashboard/files/controller.php, you can see where they simply just redirect to search, though without the die statement.
You can find several instances of this through the core, that is just one I knew off of the top of my head :)
-Scott
If you look at some of the core concrete5, namely controllers/dashboard/files/controller.php, you can see where they simply just redirect to search, though without the die statement.
You can find several instances of this through the core, that is just one I knew off of the top of my head :)
-Scott
Its an interesting point about the die. What is the overhead of not doing an exit or die after a redirect?
On a similar note, what is the overhead of doing the redirect from view() rather than from on_start()?
On a similar note, what is the overhead of doing the redirect from view() rather than from on_start()?
die "die" isn't necessary but it's a habit of mine which makes sure that no code is executed after the redirect. In theory it could happen that the controller calls more stuff after the on_start (or view) method has been called.
Better safe than sorry I think.. Besides, a "die" isn't expensive..
Better safe than sorry I think.. Besides, a "die" isn't expensive..
Also, in theory a client doesn't have to respect that header. Check this article what happens if there's no "die" and a client that doesn't care about header('location..
http://thedailywtf.com/Articles/WellIntentioned-Destruction.aspx...
http://thedailywtf.com/Articles/WellIntentioned-Destruction.aspx...
Agreed. David Sielert brought this up to me a few years ago.
the overhead is a bit more stuff runs, but it isn't the end of the world.
-Scott
-Scott
I just did a bit of digging on redirect. Here is the the core code from concrete/libraries/controller:
public function redirect() { $args = func_get_args(); $url = call_user_func_array(array('View', 'url'), $args); if ($url == '') { $url = BASE_URL . DIR_REL; } header("Location: " . $url); exit; }
ah, looks like Andrew knows about that too ;-)
Thanks for pointing that out!
Thanks for pointing that out!