1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Generic Dialogue Box

Discussion in 'XenForo Development Discussions' started by Myke623, Oct 26, 2014.

  1. Myke623

    Myke623 Active Member

    Is there a recommended way of using a generic dialogue box for the purposes of informing/warning the user?

    To date, I've been using a simple template:
    <xen:h1>{$title}: {$subtitle}</xen:h1>
    <div class="sectionMain">
        <div class="primaryContent">{$message}</div>
        <div class="sectionFooter overlayOnly">
            <a class="button primary OverlayCloser">{xen:phrase close}</a>
    In my controller, depending on what conditions are met I'll either return the intended view or the above "info" view with context specific $title, $subtitle and $message.

    Just wondering if there's a facility within XenForo that will achieve the same thing and forgo the need for me to have this template?
  2. Brogan

    Brogan XenForo Moderator Staff Member

    The Notices system?

    Or is this part of an add-on?
  3. Myke623

    Myke623 Active Member

    Yeah, sorry, this is part of an add-on.

    An example of my basic dialog:

  4. Brogan

    Brogan XenForo Moderator Staff Member

    You could use the default error overlay?

    $this->error(new XenForo_Phrase('please_enter_message_with_no_more_than_x_characters', array('count' => $maxLength)), 'message');
    Myke623 and Chris D like this.
  5. Myke623

    Myke623 Active Member

    I don't think 'error' is a valid Controller method, and that's where I'm looking to use this functionality.

    But following on from this, I can return a responseError() to achieve the same thing. Thanks for the tip!
    Brogan likes this.
  6. Chris D

    Chris D XenForo Developer Staff Member

    Indeed, the particular error message syntax used above is for the DataWriter but responseError is indeed available for controllers.
    Myke623 and Brogan like this.
  7. Brogan

    Brogan XenForo Moderator Staff Member

    Sorry, yes, I overlooked the bit in your post about it being in the controller.

Share This Page