Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » pb with dataobjectmanager testimonial example

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4 5
Go to End
Author Topic: 3308 Views
  • servalman
    Avatar
    Community Member
    211 Posts

    pb with dataobjectmanager testimonial example Link to this post

    Hello

    I'm trying to use dataobjectmanager so I tried to folow the example provided in :

    http://doc.silverstripe.org/modules:dataobjectmanager

    It works ok as far as creating page type (I get the user interface page as shown).

    Now it seems that I don't get something regarding the template and my question is what should be its name (Testimonials or TestimonialPage ?) and what is the the variable(s) I should put in it:
    $Testimonials or $Testimonial .

    Everytime I try to see it on the draft site I get :

    ModelAsController::getNestedController() returned bad object type 'TestimonialPage'

    & also this :

    Source

    61       }
    62       
    63       try {
    64          $result = $this->getNestedController();
    65          
    66          if($result instanceof RequestHandler) {
    67             $result = $result->handleRequest($this->request);
    68          } else if(!($result instanceof SS_HTTPResponse)) {
    69             user_error("ModelAsController::getNestedController() returned bad object type '" .
    70                get_class($result)."'", E_USER_WARNING);
    71          }
    72       } catch(SS_HTTPResponse_Exception $responseException) {
    73          $result = $responseException->getResponse();
    74       }
    75       
    76       $this->popCurrent();

    Trace

    * ModelAsController::getNestedController() returned bad object type 'TestimonialPage'
    Line 70 of ModelAsController.php
    * ModelAsController->handleRequest(SS_HTTPRequest)
    Line 283 of Director.php
    * Director::handleRequest(SS_HTTPRequest,Session)
    Line 127 of Director.php
    * Director::direct(/new-testimonialpage-2/)
    Line 127 of main.php

    I have to say I'm lost as I'm not a 'pro' develloper

    (if someone can provide me the Testimonial template it would be a great help for me to understand)

    Thanks a lot if someone can help me finish the example

    T

  • UncleCheese
    Avatar
    4085 Posts

    Re: pb with dataobjectmanager testimonial example Link to this post

    Templates are always named after the page type that controls them, so in this case you want TestimonialsPage.ss in your templates/Layout dir.

    To loop through all the records associated with that page, use a control block:

    <% control Testimonials %>
    $SomeField $AnotherField
    <% end_control %>

  • servalman
    Avatar
    Community Member
    211 Posts

    Re: pb with dataobjectmanager testimonial example Link to this post

    Thank you that helped very much and it is now workin .

    I have another question tough :

    I'm now trying to make kind of Testimonial menu like :

    testitmonial 1 - testitmonial 2 - testitmonial 3 etc..

    I tried to doit by using :

    <% control Testimonials %>
    $Testimonials
    <% end_control %>

    It gives me something like : #1 - #2 - #3 but the links are all leading to home page.

    Is there a way to achieve this?

    Doest it have something to do with the TestimonialsPage_Controler

    Thanks for pointing the direction

    Thomas

  • UncleCheese
    Avatar
    4085 Posts

    Re: pb with dataobjectmanager testimonial example Link to this post

    No, you're already in the testimonials control. Within that, you should be referring to fields on the Testimonials record. Think about it.. if you just say $Testimonials, how is the template supposed to know how you want to present all of those records? Which fields on each Testimonial record do you want to show, and in what kind of HTML structure?

    You should read up on dataobject relationship managment in the docs, tutorial #5. That should get you squared away.

  • servalman
    Avatar
    Community Member
    211 Posts

    Re: pb with dataobjectmanager testimonial example Link to this post

    Thank you

    I started to give a look to this tutorial, but I think it is a bit hard for me because it is not showing the :

    Project_Controller extends Page_Controller{
    }

    I wish the dataobjectmanager testimonial example would show how it works to do what I want because I think it is very commun.

    I will try tough and let you know how it goes from what I see I think I have to build up 2 controlers.

    If I can undertand it I will make a very simple tutorial about that.

    Thanks anyway

  • servalman
    Avatar
    Community Member
    211 Posts

    Re: pb with dataobjectmanager testimonial example Link to this post

    Dear Uncle cheese

    I've been trying to achieve what I want but I'm still stuck with this 'upper menu' thing.

    Evrything I read seems very unclear .

    Could you please be more specific about the controler I have to create to do it

    My project is now stuck by that and that other flash thing I posted .

    I'm quite desperate since it is now a hours I'm trying to do this.

    thanks

    Thomas

  • UncleCheese
    Avatar
    4085 Posts

    Re: pb with dataobjectmanager testimonial example Link to this post

    Préférais-tu continuer en français?

  • UncleCheese
    Avatar
    4085 Posts

    Re: pb with dataobjectmanager testimonial example Link to this post

    C'est juste que je le trouve difficile de te comprendre..

    3308 Views
Page: 1 2 3 4 5
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.