1267 Posts in 351 Topics by 486 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 360 Views |
-
Control limit in subpage(children).

22 November 2012 at 3:56pm
I have page:
ProjectsAndServicesPage.php
RecentProjectObject.php
RecentProjectImagesObject.php
ProjectsAndServicesPage.ssProjectsAndServicesPage.php
class ProjectsAndServicesPage extends Page {
static $db = array(
);
static $has_one = array(
'ImageListProjects' => 'Image',
);
static $has_many = array(
'RecentProjectObject' => 'RecentProjectObject'
);
}RecentProjectObject.php
class RecentProjectObject extends DataObject{
static $db = array();
static $has_one = array(
'ProjectsAndServicesPage'=>'ProjectsAndServicesPage'
);
static $has_many = array(
'RecentProjectImagesObject'=>'RecentProjectImagesObject'
);
}RecentProjectImagesObject.php
class RecentProjectImagesObject extends DataObject {
static $db = array(
);
static $has_one = array(
'ImageRecentObject' => 'Image',
'RecentProjectObject' => 'RecentProjectObject',
);}
ProjectsAndServicesPage.ss
<% control RecentProjectObject %>
<li<% if Last %>class="last"<% end_if %>><h3>$TitleProject</h3>
<p class="welcome">$WelcomeProject</p>
<ul class="clearfix">
<% control getRecentProjectImagesObjects %>
<li<% if Last %>class="last"<% end_if %>><a href="">$ImageRecentObject.CroppedImage(198,148)</a></li>
<% end_control %>
</ul>
<p><span>$Designer</span>$ContentDesigner</p>
<p><span>$ProjectManagement </span> $ContentProjectManagement</p>
<p><span>$ProjectManager </span>$ContentProjectManager </p>
<p><span>$Completed</span>$ContentCompleted</p></li>
<% end_control %>ProjectsAndServicesPage.php
class ProjectsAndServicesPage_Controller extends Page_Controller {function getRecentProjectImagesObjects($limit = 3) {
$url = $this->request->param('ID');
return DataObject::get("RecentProjectImagesObject", "RecentProjectObjectID='$url'", "ID Asc", "", $limit);
}}
I write <% control getRecentProjectImagesObjects %>. This doesn't work. Please Help
-
Re: Control limit in subpage(children).

18 December 2012 at 11:59pm
Hi,
In the template, you access your "RecentProjectImagesObjects" when looping through the "RecentProjectObject ". I think your "getRecentProjectImagesObjects" function should be written in "RecentProjectObject.php", not in the page controller.
| 360 Views | ||
|
Page:
1
|
Go to Top |


