I’m pretty sure I’ve overcomplicated what I’m trying to do here, but at this point, I feel like I’m just chasing my tail and need someone to point out my mistake. Here goes:
First, some backstory. I have a page that displays a list of press releases in PDF format (title, link to a PDF and date published). It is being populated using Ditto, and I’m pulling in content from sub-documents. Each press release is contained in its own document. The title is being pulled from the longtitle field and the date is the pubdate, and the link is actually a TV called "release-upload," which is set as a "File" and allows the user to upload a PDF (keep this TV in mind; it has to do with the problem I’ll mention at the end). Everything related to this section I just described is working fine.
Now, here’s my problem. I also want to display on the site’s homepage the titles and links (to the PDFs) of the 10 newest press releases, and I plan to do this using Ditto. However, the client wants the ability to "uncheck" a check box on the individual press release page. Doing so would have no affect on the press release list page I mentioned earlier, but it would keep it from showing up on the homepage.
So, here’s what I’ve done to make this (mostly) work. On the homepage, I make this Ditto call:
[!Ditto? &parents=`35` &display=`10` &orderBy=`createdon DESC` &tpl=`pressrelease-tpl`!]
That template chunk (pressrelease-tpl) contains a reference to this template variable:
That template variable (pressrelease-toggle) is set up as a Check Box, and has template access from the homepage template and the individual press release page template. Under Input Option Values, it has:
So, if the checkbox is checked, it loads the home-headlines chunk, which looks like this:
<li>
<a href="[+release-upload+]" rel="external">[+pagetitle+]</a>
</li>
You’ll notice that [+release-upload+] is the TV that I mentioned earlier. It’s attached to the individual press release page, which allows you to upload a PDF. Now, here’s the weird part: on the homepage, this method actually works fine for the page title, but [+release-upload+] isn’t generating anything.
What’s going wrong here? It seems like I should easily be able to grab this TV’s value, but it isn’t working. It does work fine on the press release page, which is what’s blowing my mind. Any suggestions on how I can fix this method I used, or possibly suggest an easier method? I’m only so-so with raw php/writing my own snippets/accessing the API, so if you do have a solution that relies on those methods, I’d appreciate as much of a walk-through as possible.
Thanks, everyone!