ridgedale Posted May 7, 2017 Share Posted May 7, 2017 Hi, I'm trying to append a contact form to the existing contact page content. The existing content for the _main.php page is as follows: <div id='content-body'> <?=page()->body?> </div> I've created a contact.php page and have included the following code but the form is not being rendered: <?php namespace ProcessWire; // This is the form for the /contact/ page. ?> <div pw-append="content-body"> <div id="contact-form"> // ... contact form details here </div> <p> </p> </div> The following is returned in debugging mode which doesn't appear to be of much help: Quote 3. replace => #content-head ... <h1 id='content-head'></h1> 4. replace => #content-body ... <div id='content-body'></div> 6. replace => #sidebar ... <aside id='sidebar'></aside> Any thoughts on what I am doing wrong? Any help appreciated. Link to comment Share on other sites More sharing options...
ridgedale Posted May 11, 2017 Author Share Posted May 11, 2017 Update: I'm not sure why but the failure to render the page properly must have been due to an error in my code somewhere; pw-append works exactly as above with single quotes or double quotes. 1 Link to comment Share on other sites More sharing options...
webhoes Posted May 15, 2017 Share Posted May 15, 2017 pw-append should be a class attribute. Assuming that you want to append to the div with id content-body, it should be lik this. <div id="content-body" class="pw-append"> <div id="contact-form"> // ... contact form details here </div> <p> </p> </div> In the config you also need to have set the following: $config->useMarkupRegions = true; Link to comment Share on other sites More sharing options...
szabesz Posted May 15, 2017 Share Posted May 15, 2017 4 minutes ago, webhoes said: pw-append should be a class attribute Not anymore, see: https://github.com/processwire/processwire-issues/issues/238#issuecomment-292906205 quote: The class attributes of the type you mentioned aren't staying, as it seemed like everyone preferred attribute support instead. Here's how you can use that: <img pw-append='sidebar' src='<?=$page->image->url?>'> The pw-append attribute can also be data-pw-append if you prefer it. Finalized Markup Regions: https://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/ Link to comment Share on other sites More sharing options...
webhoes Posted May 15, 2017 Share Posted May 15, 2017 Thanks for the update. I missed that article. However the old method still works... I have it in action on this website https://chrysemys.nl 1 Link to comment Share on other sites More sharing options...
szabesz Posted May 15, 2017 Share Posted May 15, 2017 2 minutes ago, webhoes said: However the old method still works... Good to know, thanks for the info. However, probably it is best to update the code, I guess. Link to comment Share on other sites More sharing options...
webhoes Posted May 15, 2017 Share Posted May 15, 2017 Has to go on the todo list, got 3 other sites to do first... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now