7939 Posts in 1472 Topics by 944 members
|Go to End||Next >|
3 April 2009 at 2:25pm
Hi there, just more info of the bug reported a post above. I have tried on another OSX system, the popup worked as expected in Safari and in Firefox the popup appeared but only contained the statement "I can't handle sub-URLs of a CMSMain object."
3 April 2009 at 3:11pm
@ howardgrigg, I had this same issue and can't for the life of me remember what was causing it. I ended up fixing it though, it was something I was doing wrong in the code. I'll do my best to remember what it was. Good luck!
4 April 2009 at 7:30am Last edited: 4 April 2009 7:30am
Cause of the issue mentioned in my post of 1 April 2009 at 10:03am:
Using the line from trunk, the pop-up's save button works correctly; with the line from nestedurls, it does not.
My post of 1 April 2009 at 10:03am:
I'm running revision 103 of DataObjectManager against revision 73881 of trunk. When I click the "save" button on the "add" pop-up window, the object I'm trying to add never gets saved to the database. Instead, I get sent to some kind of page that has an add link and a search box, etc.
The "add" pop-up window's form tag is as follows:
<form id="DataObjectManager_Popup_AddForm" action="admin/EditForm/field/Articles?ctf[Articles][per_page]=10&ctf[Articles][showall]=0&ctf[Articles][sort]=Created&ctf[Articles][sort_dir]=DESC&ctf[Articles][search]=&ctf[Articles][filter]=" method="post" enctype="application/x-www-form-urlencoded">
Is that the correct action? It looks funny to me.
4 April 2009 at 9:10am
Hi Uncle Cheese
Fantastic work! The DataObjectManager is just what I needed.
Do you have an example of how to setup ManyManyDataObjectManager? I want to use it to enable users to select images to go in the right column on the page and have have the ability to have different images on everypage. I might have missed something but when I use DataObjectManager it puts the same objects on every page.
4 April 2009 at 9:19am Last edited: 4 April 2009 9:19am
Great use of the DataObjectManager. I'd recommend using a ManyManyFileDataObjectManager if I were you, since it will display the images in a grid for you, as well as streamline the upload process.
If you have the many_many relation set up correctly, it should be the same as a ManyManyComplexTableField, only with one more argument.
'Image' // The fieldname on the $has_one array of your MyImage dataobject.
array( // headers...
You can read more in the documentation in the SS wiki.
4 April 2009 at 10:06am
Uncle Cheese. Thank you for all your hard work and help.
I would like to use the Testimonials page type to manage testimonials. I have set up the page so that I can add testimonials and I can see the database table where they are stored. What I don't know how to do is randomly grab a Testimonial and display it on any give page on the site. My guess is that in the Page_Controller I would have a function that could select a random Testimonial from the database and display the Testimonial Content and Author on my page. I don't need a page that shows all of the Testimonials.
4 April 2009 at 10:13am
return DataObject::get_one("Testimonial", null, true, "RAND()");
FYI: Please do not rely on the example code included with dataobject_manager. I'll be removing it soon. You can recreate it in mysite/code if you want.
8 April 2009 at 1:55pm
I have a simple question regarding the display of content in a template. I'm using FileDataObjectManager and my files are as follows:
class Partner extends DataObject
static $db = array (
'Name' => 'Text',
'URL' => 'Text'
static $has_one = array (
'Logo' => 'File',
'PartnerPage' => 'PartnerPage'
public function getCMSFields_forPopup()
return new FieldSet(
class PartnerPage extends Page
static $has_many = array (
'Partners' => 'Partner'
public function getCMSFields()
$f = parent::getCMSFields();
$manager = new FileDataObjectManager(
$this, // Controller
'Partners', // Source name
'Partner', // Source class
'Logo', // File name on DataObject
'Name' => 'Name',
'URL' => 'URL'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
// If undefined, all types are allowed. Pass with or without a leading "."
// Label for the upload button in the popup
$manager->setBrowseButtonText("Upload (JPG or GIF only)");
// In grid view, what field will appear underneath the icon. If left out, it defaults to the file title.
// Plural form of the objects being managed. Used on the "Add" button.
// If left out, this defaults to [MyObjectName]s
class PartnerPage_Controller extends Page_Controller
<% if Partners %>
<div id="partners"><div class="container">
<% control Partners %>
<li class="partner-logo"><a href="#" title="$Name" style="background-image: url('$Logo.URL')"><span>$Name</span></a></li>
<% end_control %>
</div></div><!-- end #partners -->
<% end_if %>
Can anyone tell me why the above template file PartnerLogos.ss does not return any Partners, when in the CMS I clearly have added records using dataobjectmanager and I can see them under the Partners tab in the CMS?
|Go to Top||Next >|