Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-12-03 12:43:55

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,662
Website

[solved] Splash article over contact form

I might want to put a brief message in the face of people headed to my contact form before they actually get the contact form. Something that would ensure people are on the website they think they are, or would maybe deter solicitors; any of whom would (and regularly do) otherwise post a needless and unwanted message.

A splash-like article relaying such info with a ‘continue to contact form’ link at bottom might work well.

I think I could do that by having two articles in the contact section, one a sticky (the splash article) and the other holding the comm_connect form. (Is it possible to put that form code in an article?)

But I’d kind of prefer the splash article did not have its own URL. I’d like to keep the contact section accessible/indexable by just the section URL alone so that if/when the time comes to remove the splash article again, nothing really changes but the splash article being gone.

So I’m wondering if this would be a good use of the pageless section idea, whereby keeping my contact/ section URL in tact, with the form code on the associated page template, and show a splash article from the pageless section first.

Does that make sense? Possible? How might the markup look?

Last edited by Destry (2020-12-06 17:33:17)

Offline

#2 2020-12-03 13:02:19

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,662
Website

Re: [solved] Splash article over contact form

Wait, let me kick it a while first.

Offline

#3 2020-12-04 08:17:00

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,662
Website

Re: [solved] Splash article over contact form

Well, the only way I can think to do it is create two sections, contact/ and contact-form/, and use a sticky article on the former for the splash message and put the form markup on the page of the latter. Then contact/ becomes the default link in nav, with a ‘continue to contact form’ link at bottom of the splash message pointing to the form.

But that leaves two contact-related URLs that need merged with a redirect if I stop using the splash idea. I was hoping to make it a little cleaner with only one contact/ section, but I guess if there’s always going to be two URLs generated, it doesn’t matter anyway.

That’s why I was wondering about an article from a pageless section, but I don’t really see how that helps in this case because conditional flip-flopping is still needed on the contact/ section, I think, and I can’t get that to work even with two articles in the live section. I’m guessing the comm_connect web form can not be served from an article?

Offline

#4 2020-12-04 08:52:36

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,451
Website

Re: [solved] Splash article over contact form

another way (which may result in you receiving more emails than you want), is to create a basic contact form with just a submit (which you can call continue) button and a redirect="URL" where the actual form exists in the pageless section OR you can have the same without the pageless section if you add the actual contact form in the thanks_form="form_name".

Caveat: both methods are untested:)

Last edited by colak (2020-12-04 08:56:44)


Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#5 2020-12-04 10:40:43

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,026
Website

Re: [solved] Splash article over contact form

How about:

  • Splash screen at /contact/ – Landing page of the contact section with a sticky article plus continue to contact form link.
  • Contact form at /contact/form – An article assigned to the contact section. For this article you set meta robots/content to “noindex” and the canonical url to the main section landing page so that the landing page is always protocolled by search machines.

If you change your mind in future, just add your contact form to the landing page sticky article.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2020-12-04 18:05:33

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,662
Website

Re: [solved] Splash article over contact form

colak wrote #327259:

another way (which may result in you receiving more emails than you want)

I stopped reading there. ;)

jakob wrote #327260:

For this article you set meta robots/content to “noindex” and the canonical url to the main section landing page so that the landing page is always protocolled by search machines.

That is noteworthy.

Your suggested setup with two articles in the same section is something I actually tried but couldn’t get to work. I didn’t explain that very well, but that’s what I was getting at in the last sentence. Anytime I put the contact form markup in an article and tried to juggle them conditionally, it threw errors when calling the form. Works fine if it’s just put in the page template though (of course, no splash page then).

I’ll give it another look through.

Last edited by Destry (2020-12-04 18:06:35)

Offline

#7 2020-12-04 22:00:27

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,977
Website

Re: [solved] Splash article over contact form

Destry wrote #327272:

Your suggested setup with two articles in the same section is something I actually tried but couldn’t get to work.

jakob’s solution is the simplest by far. Some pointers to solve your issues:

In your /contact Page template, add:

<txp:if_article_list>
   <txp:article status="sticky" />
<txp:else />
   <txp:article limit="1" />
</txp:if_article_list>

Thus, show sticky if you land on the bare /contact (which is what is linked to from all your nav touch points) and then in that sticky article you simply add a link to the individual article with a URL-only title of “form” (at /contact/form).

Put your com_connect code in that article by all means, but make sure to turn off Textile processing in the Body field – you want to leave text untouched or you’ll get errors and weird output galore as Textile tries to interpret your <txp:...> tags.

Alternatively, put your preamble content in your /contact/form as normal (with Textile processing) and set the article to use an override form called ‘contact_form’. Make that form in Presentation>Forms with content such as:

<txp:title wraptag="h2" />
<txp:body />
<com::connect to="...">
...
</com::connect>

As long as you make sure that whichever form ‘type’ you use for your contact_form is represented in the ‘Publish’ prefs subpanel (override_form_types) then you’ll be able to pick the contact_form from the override form list in your article. This assumes you’re using Txp 4.8.4. Otherwise you’ll need to put your contact_form as an ‘Article’ type to get it to show up, because it was hard-coded that way in all previous versions.

Hope that helps.

Last edited by Bloke (2020-12-04 22:03:40)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#8 2020-12-06 17:32:27

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,662
Website

Re: [solved] Splash article over contact form

Thank you!

I knew it had to be easier than it was seeming, and I was on the right track in principle except using the wrong conditional wrapper, which, in retrospect, was a dunce move here. Nor did I have ‘leave text untouched’ set in the form article’s body, and I had Txp in debugging mode, getting those irrelevant error notices that always confuse me.

Offline

Board footer

Powered by FluxBB