1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Creating my first addon

Discussion in 'XenForo Development Discussions' started by gldtn, Mar 17, 2011.

  1. gldtn

    gldtn Well-Known Member

    Hello, I'm trying to learn my way around xenforo and create my first add-on. So I choose to create a simple photo contest. Probably not a good idea for a first add-on, but hey, must as well give it a try!

    So I started to take the page call back function approach(http://xenforo.com/community/threads/editing-templates-and-defining-a-callback-for-pages.7226/):

    I created some folders inside the xenforo library: GLPC/PageCallback with an index.php file containing the following code:
    Code:
    <?php
    
    class GLPC_PageCallback_index
    {
        public static function respond(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract $response)
        {
            $response->templateName = 'GLPhotoContest';
        }
    }
    I then created the page with and call back to GLPC_PageCallback_index and method of respond.

    After I created the template GLPhotoContest:
    Code:
    <xen:title>{$page.title}</xen:title>
    
    <xen:navigation>
        <xen:breadcrumb source="$nodeBreadCrumbs" />
    </xen:navigation>
    
    <link rel="xenforo_stylesheet" type="text/css" href="glpc.css" />
    
    <div class="sectionMain">
        <h2 class="subHeading">Welcome to our photo contest page.</h2>
        <p>This is where the photo contest entries will appear/my data base entries pull page</p>
        <p>Ideas: Use the like system for voting/allow only one like per entry</p>
        <div class="sectionFooter"># of Entries</div>
    </div>
    But now, I want to know how to create the entry page, where user will submit the entries! Basically the page is going to call for a template where a form will pop-up for the user to enter the title, description, and be able to upload.

    Can someone steer me to the right direction. I remember seeing a post that kier put up on how to pull up and pop-up overlay with custom template, but can't find it.

    You help is appreciated!
     
  2. Jeremy P

    Jeremy P Well-Known Member

    Just give the link a class of OverlayTrigger.
     
    gldtn likes this.
  3. Nasr

    Nasr Well-Known Member

  4. gordy

    gordy Well-Known Member

    Have you had any progress with your photo contest add-on ?
     

Share This Page