Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Problem with Poll in tutorial 3

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1769 Views
  • Mednezz
    Avatar
    Community Member
    23 Posts

    Problem with Poll in tutorial 3 Link to this post

    Hello there!

    First of all my complements to this amazing framework!! Really easy to learn.

    I'm running SS on a linux server / apache2 with modrewrite and php 5.2.1

    I tried to create the browser poll. The first problem was that it could find the class BrowserPollSubmission witch i created in mysite/code/BrowserPollSubmission.php.

    I solved that by simply copy the class into the HomePage.php file.

    Next problem, when submitting the poll i get the following error :

    ERROR:
    Error

    The website server has not been able to respond to your request.

    Any idea?

    Thanks a lot!

  • xmedeko
    Avatar
    Community Member
    94 Posts

    Re: Problem with Poll in tutorial 3 Link to this post

    Do you have only one dir with your code, like "mysite"?

    I copied "mysite" to "mysite.orig" and it made me problems, because the autoloader has loaded files from "mysite.orig" first. when I deleted "mysite.orig", then the problem was solved.

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Problem with Poll in tutorial 3 Link to this post

    Hi there,

    The error obviously isn't descriptive enough, since the site is probably in a mode where it wouldn't normally give you error pages.

    Put this line in _config.php:

    Director::set_environment_type('dev');

    And try producing the same result again, it should this time give you an error that you can actually trace back.

    Cheers,
    Sean

  • Andy
    Avatar
    230 Posts

    Re: Problem with Poll in tutorial 3 Link to this post

    You can't add the BrowserPollSubmission class into HomePage.php, it needs to be in a file with with same name as the class for SilverStripe to find it. Make sure that whenever you add a new php file you do db build (http://sitename.com/db/build?flush=1).

  • Mednezz
    Avatar
    Community Member
    23 Posts

    Re: Problem with Poll in tutorial 3 Link to this post

    Thanks for all the reactions guys!

    That debug function blew my mind!!! Really great framework!!

    Got a next challenge though

    I'm trying to create a menu with 2 levels like -->

    <ul>
    <li> text </li>
    <li class="expand">text
    <ul>
    <li> text</li>
    <li>text</li>
    </ul>
    </li>
    <li> text </li>
    <li> text </li>
    <li> text </li>
    </ul>

    I'm an absolute beginner with silverstripe, but my php knowlegde isn't that bad though

    Thank you for your responses!

  • Mednezz
    Avatar
    Community Member
    23 Posts

    Re: Problem with Poll in tutorial 3 Link to this post

    Never mind....

    SilverStripe is too mighty!!

    <ul id="nav">
             <% control Menu(1) %>
             <li class="$LinkingMode<% if FirstLast %> $FirstLast<% end_if %><% if Children %> expand<% end_if %>" accesskey="$Pos">
                <a href="$Link" title="$MenuTitle">$MenuTitle</a>
                <% if Children %>
                   <ul class="Menu2">
                      <% control Children %>
                      <li class="$LinkingMode<% if FirstLast %> $FirstLast<% end_if %>">
                         <a href="$Link" title="$MenuTitle">$MenuTitle</a>
                      </li>
                   <% end_control %>
                   </ul>
                <% end_if %>
             </li>
             <% end_control %>
             </ul>

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Problem with Poll in tutorial 3 Link to this post

    That's exactly how you do it.

    Also, if you only want the children pages to show when you're on the section, just add <% if LinkOrSection = section %> inside your <% if Children %>.

    Cheers,
    Sean

    1769 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.