7912 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » the possibilities in FrontEnd
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 932 Views |
-
the possibilities in FrontEnd

16 October 2009 at 10:02am Last edited: 16 October 2009 10:03am
I have a few questions on opportunities DataObjectManager Module
I will ask them based on the code given in http://doc.silverstripe.com/doku.php?id=modules:dataobjectmanager1. Possible to show one Testimonial item in modal window?
(let's say I have a TestimonialPage that shows all Testimonials Author with link. When you click on the link opens a modal window (like in the admin part) which shows detailed information about selected author (Date,Author,Quote))2. it possible to do paging in frontEnd (like in the admin part) for TestimonialPage?
-
Re: the possibilities in FrontEnd

17 October 2009 at 1:39am
There are a number of ways to do this.
I'm not going to go through and explain how to set up a lightbox. You can use whatever one you want and follow the documentation. But to get the testimonial by ID, you need to set up an action on your controller
YourTestImonialHolderController extends Page_Controller
{
function show()
{
if(isset($this->urlParams['ID']) && is_numeric($this->urlParams['ID']) {
if($testimonial = DataObject::get_by_id("Testimonial",$this->urlParams['ID'])) {
echo $testimonial->Text;
}
}
}
}And you would access that from /URL-to-your-holder/show/123
where 123 is the ID of the testimonial you want.
-
Re: the possibilities in FrontEnd

18 October 2009 at 9:32am Last edited: 18 October 2009 9:34am
thanks
it's cool
I do not believe that it is so easy to obtainI have a another question, can I do all the same thing, only without the modal window (in the body of my TestImonialHolder)?
-
Re: the possibilities in FrontEnd

18 October 2009 at 10:35am
Yes. This is explained in the Code Examples sticky for showing a resource by category.
MyTestimonial_Controller extends Page_Controller
{
function show()
{
$testimonial = DataObject::get_by_id("MyTestimonialObject",$this->urlParams['ID']);
if($testimonial) {
return $this->customise(array(
'Testimonial' => $testimonial
));
}
return false;
}
}/my-testimonial-holder/show/123
MyTestimonialHolder_show.ss
<% control Testimonial %>
$Text $Date, etc..
<% end_control %> -
Re: the possibilities in FrontEnd

18 October 2009 at 10:38am Last edited: 18 October 2009 10:41am
I want to tell, as I realized what I needed. Maybe someone will tell you is the best way?
How to correctly handle $_GET values in SilverStripe? $this->urlParams not approached.And I have yet to be invented how to implement paging
in my code Tender extends DataObject
class TenderPage_Controller extends Page_Controller {
function showTenderID(){
if(isset($_GET['TenderID']) && is_numeric($_GET['TenderID'])) {
$tenderIt = DataObject::get_by_id("Tender",$_GET['TenderID']);
return $tenderIt ? $tenderIt : false;
}else{
return false;
}
}}
in tenderPage template<% if showTenderID %>
<% control showTenderID %>
<h3><a href="{$Top.Link}?TenderID={$ID}" title="$Name.XML" class="newsH">$Name</a></h3>
<div class="IntroText">$Description</div>
.............
<% end_control %>
<% else %><% if Tenders %>
<div class="newsList">
<% control Tenders %>
<h3><a href="{$Top.Link}?TenderID={$ID}" title="$Name.XML" class="newsH">$Name</a></h3>
<div class="IntroText">$Description</div>
....................
<% end_control %>
</div>
<% end_if %>
<% end_if %> -
Re: the possibilities in FrontEnd

18 October 2009 at 10:46am Last edited: 18 October 2009 10:50am
Thanks UncleCheese
I did as I know myself because had no time to see your answer
later I try to alter my code as you showed
| 932 Views | ||
|
Page:
1
|
Go to Top |

