Hello,
I’m working on a customized front-end for adding news to a website by combining (and hacking) FDM and Ditto.
Ditto has so far been the reliable, comforting father in this my first contact with CMSes, but I’ve come to a dead end. I have modded FDM to not publish the news documents by default, but want to handle this through the same front-end page, meaning Ditto needs to show the unpublished documents but only for moderators/admins.
Preferably, I would like to have the option of using a custom template (chunk) for the unpublished news in order to style them differently from the rest. Is there anything similar to what I’m requesting or do I have to don my plumed coding headdress?
Ah, now. I had a similar problem, there was something you need to do to allow ditto* to list unpublished pages, I wound up making a series of direct php & modx dbapi calls to check the status of a page and ’temporarily’ allowing the logged in person to view the un-published page. It is possible but it’s probably not the easiest way to do it.
The modx dbapi routine checked the status of a page (published or un-published) and I had the snippet format the placeholder differently in the tpl for the ditto item to show ’un-publish’ for published and ’publish’ for non-published articles.
Let me have a look through the code here and I’ll post what I can at some point.
Cheers
TxRx
*Make sure your using latest ditto version, there’s been revisions/fixes in the way to allow published and un-published docs to be listed.
Use PHx in the ditto tpl with an if/else statement based on the published value. You can simply change the style info, or you can change the entire output. I think you can even use PHx to load one chunk if published and another if not, need to test this to see if the ditto placeholders are parsed (I have never tested it this way, but I bet it works).
There is info on PHx in the wiki and it is installed as part of Ditto to use within the Ditto Tpl chunks and it is on by default, so it is ready to go.
Ah now, see, I’ve not played with PHx. I suspect I will be after reading your explanation
I’m going to have a closer look into half of this little lot. Seems that things have progressed quite a bit whilst I’ve been away from working in Modx