Jump to:

23453 Posts in 18902 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » SS 3.0 Global Contact Form

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

Page: 1
Go to End
Author Topic: 1285 Views
  • n0ne
    Avatar
    Community Member
    18 Posts

    SS 3.0 Global Contact Form Link to this post

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

  • sonet
    Avatar
    Community Member
    33 Posts

    Re: SS 3.0 Global Contact Form Link to this post

    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.

  • arthurdent
    Avatar
    Community Member
    163 Posts

    Re: SS 3.0 Global Contact Form Link to this post

    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');
       }
       

    }

  • thomas.paulson
    Avatar
    Community Member
    72 Posts
    1285 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.