Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Application development questions

edited November 2011 in Vanilla 2.0 - 2.8
Hi, loving using Vanilla but a couple of questions when trying to create my application.

1. How do I redirect a user to a Not Found page? At the moment I'm doing something similar to:

if ($id) {
$this->Render();
}
else {
// Redirect to not found...
}

2. When calling $this->Render() is it possible to change the layout, for example the User Profile has the sidebar on the left rather than the right, how it this accessed via $this->Render()?

Thanks for any help!

Best Answer

  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓
    When a record is not found I'd do the following:
    if (!$id)
    throw NotFoundException();
    This will render the default page not found page in the current url. It will also work when accessing the page as json.

    With regards to your layout question: the user profile renders the way it does using css rules. The body of the page always gets assigned an id and class that you can cascade from.

Answers

  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓
    When a record is not found I'd do the following:
    if (!$id)
    throw NotFoundException();
    This will render the default page not found page in the current url. It will also work when accessing the page as json.

    With regards to your layout question: the user profile renders the way it does using css rules. The body of the page always gets assigned an id and class that you can cascade from.
  • Options
    Thank you! Exactly what I needed, with regards to adding to the sidebar can this be done in the controller or view?
Sign In or Register to comment.