0

我是 Concrete5 的新手,发现了大量有关添加联系表单的信息,但仅限于页面的可编辑区域。

我需要做的是在我的页面模板中添加一个表单。它只是一个名称+电子邮件+提交按钮表单,显示在该模板的每个页面上。提交时,“感谢”信息......就是这样!

我尝试将输出到页面内容的代码复制/粘贴到我的 default.php 模板,但没有运气。提前感谢您的帮助。

4

3 回答 3

2

您应该在模板中创建一个(全局)可编辑区域,然后像其他方式一样向其中添加一个联系人块。

例如:

<?php
$a = new GlobalArea('Contact Form');
$a->display();
?>
于 2013-04-05T20:13:10.993 回答
1

I agree with the other answer here... it's not worth the trouble to re-create a "hard-coded" contact form in your theme if you already have all the code working as a block. Here's a third technique you could use to achieve that -- you can hardcode just one block instead of the entire stack, like so:

<?php Block::getByName('My Global Contact Form')->display(); ?>

Put that code in your theme's template, and then add the contact form block to a stack in the dashboard (any stack, doesn't matter -- I usually create one stack of "global content" in my sites that I put all of these "hardcoded" blocks into). Then after you've added the block to the stack, click on the block and choose "Custom Template" from the popup menu. Then enter the block name into the field there (in this example, it would be "My Global Contact Form", without the quotes). Finally, click the "Approve Changes" button at the top of the stack.

于 2013-04-08T14:39:14.463 回答
0

您可以通过几种方法来解决此问题,但一种方法是创建一个包含联系表单的堆栈。然后,取该堆栈的名称并将其添加到您的模板中。

因此,如果堆栈被称为“全球联系表”,那么您可以将以下内容添加到您的模板中:

$stack = Stack::getByName('Global Contact Form');               
if( $stack ) $stack->display();
于 2013-04-05T16:53:57.960 回答