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.

Archive /

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

Moderators: martimiz, Sean, biapar, Willr, Ingo

Problem with Poll in tutorial 3


Go to End
Reply


7 Posts   1899 Views

Avatar
Mednezz

Community Member, 23 Posts

30 May 2007 at 3:37am

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!

Avatar
xmedeko

Community Member, 94 Posts

30 May 2007 at 9:07am

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.

Avatar
Sean

Forum Moderator, 922 Posts

30 May 2007 at 9:11am

Edited: 30/05/2007 9:12am

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

Avatar
Andante

Community Member, 231 Posts

30 May 2007 at 11:27am

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

Avatar
Mednezz

Community Member, 23 Posts

2 June 2007 at 9:21am

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!

Avatar
Mednezz

Community Member, 23 Posts

2 June 2007 at 9:55pm

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>

Avatar
Sean

Forum Moderator, 922 Posts

2 June 2007 at 10:07pm

Edited: 02/06/2007 10:08pm

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