Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

SS 3.0 Global Contact Form


Go to End
Reply


4 Posts   1485 Views

Avatar
n0ne

Community Member, 18 Posts

12 September 2012 at 1:56pm

Hi, I'd like to know if how to make a 'quick contact' form in footer of every page (global form).

Avatar
sonet

Community Member, 33 Posts

12 September 2012 at 3:10pm

Follow this tutorial: www.ssbits.com/creating-a-simple-contact-form/

Instead of creating a ContactPage.php add the code to your Page.php and your footer template.

Avatar
arthurdent

Community Member, 188 Posts

17 July 2014 at 11:46am

This is just the sort of thing that I would like on my personal site but I'm having issues -- when I add form code to Page.php I can't rebuild DB. Don't think there's anything deprecated as it looks like fairly standard php expressions -- but then again I'm really a graphic designer, not a programmer per se.

Can somebody please advise:

1. What is the difference between 'private static' and simply 'static'

2. Has the expression 'static' become deprecated in SS3?

3. Do I need to 'thread' (concantenate) form code into code already on Page.php (below)

TIA

<?php
class Page extends SiteTree {

	private static $db = array('SidebarHTML' => 'HTMLText'
	);

	private static $has_one = array(
	);
function getCMSFields() {
		$fields = parent::getCMSFields();
		$fields -> addFieldToTab("Root.Sidebar",new HTMLEditorField("SidebarHTML"));
		return $fields;
	}
	
	
	
}
class Page_Controller extends ContentController {

	/**
	 * An array of actions that can be accessed via a request. Each array element should be an action name, and the
	 * permissions or conditions required to allow the user to access it.
	 *
	 * <code>
	 * array (
	 *     'action', // anyone can access this action
	 *     'action' => true, // same as above
	 *     'action' => 'ADMIN', // you must have ADMIN permissions to access this action
	 *     'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
	 * );
	 * </code>
	 *
	 * @var array
	 */
	private static $allowed_actions = array (
	);

	public function init() {
		parent::init();
		// You can include any CSS or JS required by your project here.
		// See: http://doc.silverstripe.org/framework/en/reference/requirements
		
		// Note: you should use SS template require tags inside your templates 
		// instead of putting Requirements calls here.  However these are 
		// included so that our older themes still work
		
		Requirements::javascript(THIRDPARTY_DIR.'/jquery/jquery.min.js'); //include jquery 1.7.2 bundled with ss
		//Requirements::javascript('http://code.jquery.com/jquery-1.7.2.min.js');
		Requirements::javascript('themes/'. SSViewer::current_theme() .'/javascript/navscript.js'); //link to js file in current theme folder
			
		//Requirements::themedCSS('reset');
		//Requirements::themedCSS('960-12-col');
		//Requirements::themedCSS('Layout'); 
		//Requirements::themedCSS('Typography'); 
		//Requirements::themedCSS('form'); 
	}
	

}

Avatar
thomas.paulson

Community Member, 86 Posts

22 July 2014 at 5:11am