21489 Posts in 5783 Topics by 2622 members
|Go to End|
10 July 2009 at 5:12am
I have a DataObject that contains some HTMLText and possibly a link to a file for download. When a front end user clicks a link I want a popup to show up and display the DataObject via an ss template. I am not sure how to go about this.
I do know how to make jQuery send an ajax request to a helper Controller that gets the DataObject that the user clicked on. However I don't know how to write the code that will render the DataObject with a template and send the link back to the client computer so that it can open a lightbox or similar with the url of the rendered data. I am not using a PageType for the DataObject.
10 July 2009 at 2:06pm
I'm trying to do the exact same thing and I am equally as confused..
1 September 2009 at 11:09pm
i am looking for some advice, too. How do implement an template.ss which does not interherit from page but from dataobject class?
Does anybody know a good tutorial?
2 September 2009 at 6:14am
Essentially you have to tell the object if its called with AJAX to render the data with differently.
There's a lot of good stuff in the Recipes section, but the Link to them isn't as obvious as it should be
Also check ssbit.com, it has some really well written tutorials explaining stuff better than some of the documentation
3 September 2009 at 12:26am
thanks for your reply. I went through the ajax_basics and everything is working fine. But i am not sure where to go from here? I have got ajaxSnippet.ss Template that will be loaded into a <div> in page.ss. But what i need is to open the thickbox and load the ajaxSnippet.ss into the thickbox.
Link to open thickbox:
<a href="/silverstripe/ajax.php?refid=$ID&height=381&width=613" class="thickbox" title="$Headline">
Link to load asynchronisly content into <div>:
<a href="$URLSegment" onclick="jQuery('#ajaxContent').load('$URLSegment/showImage'); return false;" >
Can anybody help?
3 September 2009 at 1:52am Last edited: 3 September 2009 1:53am
I've never used Thickbox. I usually go with FaceBox or ColorBox. But you should just be able to structure your Thick box URL something like:
<a href="$Link?height=220&width=400" class="thickbox" title="$Headline">$Title</a>
But I'm not sure how the wrapping controls are structured. You're using $URLSegment which returns the Current Page Segment (ie everything after '/silverstripe/' which isn't the full link. You should be forming the link to point to the Dataobject as if it were a page. Silverstripe will see that the call is an AJAX call and render it accordingly. The only problem I can see is Silverstripe may not like the URL Parameters, so another Model Box Plug-in may be more useful.
|Go to Top|