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

Display Contact form in a page?

Discussion in 'Styling and Customization Questions' started by Morgain, Jan 8, 2012.

  1. Morgain

    Morgain Well-Known Member

    Can I display the Contact form in a page please?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Add this to the page template HTML: <xen:include template="contact" />

    However, the contact page is already a standalone page - right click on Contact Us on your own site and open in a new tab to see it: http://www.housemorgain.co.uk/circle/misc/contact
     
    Morgain likes this.
  3. Morgain

    Morgain Well-Known Member

    It didn't like that. I tried it above and below the title line, and below at the bottom.

    <xen:include template="contact" />

    This is on the "contact " template to make it load as an ordinary page, right?
     
  4. Morgain

    Morgain Well-Known Member

    OK I got that worked out - it needed to close with </contact>
    That works for making the Contact form appear on ANOTHER page - like when the private Members' page is clicked by an outsider.

    Except it appears without CAPTCHA?
    There's a "helper_captcha_unit" linked to the contact form template. It seems the "include" doesn't call that.



    But actually what I wanted here was to make the Contact page appear on a normal page anyway - not be a popup if you are a member too.
     
  5. Brogan

    Brogan XenForo Moderator Staff Member

    I'm not quite sure what it is your're trying to do.

    If you remove the red portion below from the code in the footer template though, it will open in a new page.

    Code:
    <li><a href="{xen:link 'misc/contact'}" class="OverlayTrigger" data-overlayOptions="{&quot;fixed&quot;:false}">{xen:phrase contact_us}</a></li>
    The captcha will only appear for guests.
     
    Morgain likes this.
  6. Morgain

    Morgain Well-Known Member

    Thanks Brogan that's exactly it.
    That is looking very good now.

    I wonder if there's a code snippet could be added maybe to EXTRA.css so it's global,
    so if a visitor clicks ANY private link they get the contact form just like this?

    That would be mega cool for my site which is mostly private.
     
  7. Brogan

    Brogan XenForo Moderator Staff Member

    You can't do that with CSS, you would need to wrap each item in a conditional statement.

    Other than nodes and profiles pages though, which can be protected from guests using permissions, the only other page you would need to restrict is the members page, which you have already done.
     
    Morgain likes this.
  8. Morgain

    Morgain Well-Known Member

    I found there's a bit more code has to be commented out in that footer link.
    Just to help anyone else wanting the same - maybe there are others a bit weird like me!
    it then looks like this:

    Code:
    <ul class="footerLinks">
                <xen:hook name="footer_links">
                    <xen:if is="{$xenOptions.contactUrl.type} === 'default'">
                        <li><a href="{xen:link 'misc/contact'}"> <!-- class="OverlayTrigger"  data-overlayOptions="{&quot;fixed&quot;:false}"> --> {xen:phrase contact_us}</a></li>[/CODE=rich]
     
  9. Morgain

    Morgain Well-Known Member

    Yes exactly - lots and lots of node forums! Oh maybe if I put the include contact bit on the forum_view template? I'll try that.
     
  10. Morgain

    Morgain Well-Known Member

    Yes that works.I'm delighted as that will bring in a few members. We get a steady trickle through various connections but no harm in adding a few more this way.

    But does that mean they get shut out even if I've set a node to public access?
    (Sorry atm I'm struggling with access permissions and I seem to have set everything to private! so I can't test)
     
  11. Morgain

    Morgain Well-Known Member

    Brogan the captcha is not working for an outsider who wants to use the Contact form.

    You thought at first it was not showing Captcha to me because I'm a member.
    But I now have feedback that an outsider doesn't see it either and can't send the form because they get a captcha not filled in error.
    I got someone else to test it to confirm.

    You can test on www.housemorgain.co.uk/circle
    then click Members on the navbar.
     
  12. Brogan

    Brogan XenForo Moderator Staff Member

  13. Morgain

    Morgain Well-Known Member

    Thank you yes.

    But if you click a private area like Members, where you helpedme add code, you get a message explaining PLUS the COntact form.
    That's where the captcha doesn't display and throws error.
     
  14. Brogan

    Brogan XenForo Moderator Staff Member

    Can you provide a link?

    Why don't you just link to the main contact page instead of embedding it in a Page node?
     
  15. Morgain

    Morgain Well-Known Member

    The code you gave me works like this.
    I put
    Code:
    <!-- hide from unreg -->
    <xen:if is="{$visitor.user_id}">
    at the top of the page under its title.

    Then after the sidebar I put
    Code:
    <!-- End hide for unreg -->
    <xen:else />
    <div class="RoundedDiv" style="padding: 15px; float-left; margin-left: 100px; margin-top: 30px; margin-bottom: 20px; font-size: medium; color: green; background: #ffffff; width: 600px;">
    <center><b>If you are a member of House Morgain</b> you are seeing this message because you are not logged in - probably you timed out. Log in using the link top right.<br /><br />
     
    <b>TO OUR VISITORS</b><br />we apologise for the inconvenience to you, but the link you clicked is a private members' only area.<br />
    To join House Morgain so you can access the whole community<br />instead of just the public areas, <br />please contact us with a little bit of information about what interests you in our community.</center>
    </div>
     
    <div style="float: left;  margin-left: 100px;">
    <xen:include template="contact" /></include>
    </div>
    </xen:if>
    That means the outsider sees the Contact form.
    But if I open the contact template it has a connected template helper_captcha_unit
    This doesn't automatically connect to the contact form if it's embedded in another page. It doesn't show as a tab (connected template) if I look at member_list though contact does now show as a tab there.

    I tried putting
    Code:
    <xen:include template="helper_captcha_unit" /></include>
    with the include for the contact form but it still doesn't display - although progress! helper_captcha_unit now shows as a connected tab with member_list
    I placed the second include right under the first. (Putting it inside the first threw an error)
     
  16. Brogan

    Brogan XenForo Moderator Staff Member

    In which case the captcha won't work embedded on a Page node, you will likely need a php callback to get it to function.

    You could embed the page using an iframe but it's ugly and not really a viable solution.
     
  17. Morgain

    Morgain Well-Known Member

    No I agree I hate frames.

    OK I'll make it a simple link.

    Maybe someone else might do the php callback for us later. It makes a really neat way to get outsiders to write in - of course every time you ask them to click it's a barrier.

    Thank you for your help as always Brogan.
     
  18. Gene Steinberg

    Gene Steinberg Well-Known Member

    I have a sort of similar problem for which I could use guidance.

    I would like to link to the contact form from another page on our site, a regular HTML page. But if I just use the direct link to Contact Us, it doesn't deliver the form in an overlay, and, when someone uses it, it doesn't clear when the message is sent. Thus I get several messages, rather than one.

    Hope this is clear.

    So is there a way to do this without reinventing the wheel -- but I'll go for that to with proper guidance.
     

Share This Page