it makes the link but when you click it,it just goes to homepage, and doesnt display it. im new to silver stripe, and all the tut links is from cms where you putted it in, but this one from my db is giving me problems
@UC - Did that work? Have you added it or does it need to be changed? Just wondering as it would be great not to have to make the changes for DOM in SiteConfig every time.
@Geo - This is because your DataObjects are not pages so they can't be displayed like that. I wrote a tutorial a while back on how to display DO on a page, but unfortunately it requires a little extra work to get going on 2.4. Still have a look through as it will give you a basic understanding of what is going on and I did leave a comment which points in the direction of making it work in 2.4.
I will be releasing a new Tut on doing this 'properly' in 2.4 when the NEW SSBits site launches soon ;)
www.ssbits.com - SilverStripe Tutorials, Tips and Other bits
I just wanted to chime in and say that setSourceID can be used in other contexts since it can be used to add a DOM to a page that's linked to something else. Not a very common usecase perhaps but I've used setSourceID like that a couple of times and it works great. The difference to Arams code is that in my version I give $sourceID precedence in the sourceID() function since I'm figuring that if I actually go and set it myself manually then it's a special case and I specfically want that behaviour.
So the difference in my version is that I check $this->sourceID first in the sourceID() function and return that if it's set, otherwise do the normal stuff.
Sorry, should have mentioned that. Adding photo works fine, but when you click on that photo in image dom to get details the following error occurs:
[User Error] Couldn't run query: SELECT "SlideshowPhoto"."ClassName", "SlideshowPhoto"."Created", "SlideshowPhoto"."LastEdited", "SlideshowPhoto"."Caption", "SlideshowPhoto"."ImageID", "SlideshowPhoto"."CustomSiteConfigID", "SlideshowPhoto"."ID", CASE WHEN "SlideshowPhoto"."ClassName" IS NOT NULL THEN "SlideshowPhoto"."ClassName" ELSE 'SlideshowPhoto' END AS "RecordClassName" FROM "SlideshowPhoto" WHERE ("ParentID" = '1') Unknown column 'ParentID' in 'where clause'
Line 536 in /.../sapphire/core/model/MySQLDatabase.php