Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » Can't add review section in page

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

Page: 1
Go to End
Author Topic: 914 Views
  • Anujit
    Avatar
    Community Member
    3 Posts

    Can't add review section in page Link to this post

    URL: http://golf.kc316.com/listingpage/show/17

    All I am doing is based on search results, showing the details of golf course. Its working. I want to show the reviews made against the golf course. I tried adding a ReviewSection function. But didn't work.

    Have anyone any idea?

    The details page is named 'ListingPage.php'. The code snippent for ListingPage.php and ListingPage.ss is as below.

    <b>LisingPage.php</b>

    class ListingPage extends Page {
    }
    class ListingPage_Controller extends Page_Controller {
    static $allowed_actions = array(
    'show'
    );

    public function getGolfCourse()
    {
    $Params = $this->getURLParams();

    if(is_numeric($Params['ID']) && $DT_GolfCourseProfile = DataObject::get_by_id('DT_GolfCourseProfile', (int)$Params['ID']))
    {
             Session::set('gfid', $Params['ID']);
    return $DT_GolfCourseProfile;
    }
    }
    function show()
    {
    if($DT_GolfCourseProfile = $this->getGolfCourse())
    {
    $Data = array(
    'DT_GolfCourseProfile' => $DT_GolfCourseProfile
    );

        return $this->Customise($Data);
    }
    else
    {
    return $this->httpError(404, 'Sorry that golf course could not be found');
    }
    }

    /*
    function ReviewSection($num=5)
       {
          if($_SESSION['gfid'] != null)
             return DataObject::get("Review", "GolfCourseID = ".$_SESSION['gfid'], "CREATED DESC", null, $num);
          else
             return false;
       }
    */
    }

    <b>ListingPage.ss</b>

    <div id="layoutListingPage">
    <div class="panel" id="container">
       <% control DT_GolfCourseProfile %>                  
          <div class="listings show" id="canvas">
             <div class="paid-listing" id="left-column">
                <div class="hreview-aggregate panel" id="basic-info">
                   <div class="vcard item">
                      <LH1 class="fn org">
                         $GCName
                      </LH1>
                      <p class="phone"><strong>$GCContPhone</strong></p>
                      <p class=""><strong><b>Fax: </b>$Fax</strong></p>
                      <p class=""><strong><b>Email: </b>$Email</strong></p>
                      <p class="primary-location" style="">
                         <span class="listing-address">
                            <span class="street-address">$Street</span>,
                            <br/>
                            <span class="city-state">
                               <span class="locality">$State</span>,
                               <span class="region">$City</span>,
                               <span class="postal-code">$Zip1-$Zip2</span>
                            </span>
                         </span>

                      </p>
                      <p class="location-description truncated" style="">
                         Near $County
                      </p>
                   </div>
                   
                </div>
                <div class="section" id="business-reviews">
                   <div class="panel header">
                      <LH2>Reviews &amp; Recommendations</LH2>

                      
                      <% control ReviewSection %>
                         $Comments <br /><br />
                      <% end_control %>

                      <p class="section-action"><a href="review" class="track-write-review write-review-link no-tracks" rel="nofollow">Write a Review</a></p>
                   </div>
                </div>
             </div>
          </div>
       </div>
       <% end_control %>
    </div>
    </div>

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