Publish a reference's as a file

birwin's Avatar


02 Jul, 2015 12:59 PM

Hi All, I read through the list of discussions, but didn't find an answer to this question,

We're setting up a new site in Cascade, one which will be updated in-frequently but works like a blog, where the front page will become the "most-recent" content within a given folder. Getting the page to serve up the most recent content is easy to accomplish, but since we're diving the content up like /yyyy/mm/index, we would want the /index (root page) be a reference to {current-year}/{current-month}/index. Creating a reference work, but it doesn't look like the reference is published, it's more used with the index blocks.

I was hoping to be able to simply update a reference pointer each month which could publish, versus having the /index page be modified to point to the index blocks for the current year/month.

Any ideas are appreciated. Probably overlooked something simple.



  1. 1 Posted by Wing Ming Chan on 02 Jul, 2015 05:08 PM

    Wing Ming Chan's Avatar

    Hi Brendon,

    Assuming that you are willing to use web services in PHP, this can be done quite easily.

    1. I assume that you can create a cron job to execute a PHP script on the first or second day of every month.
    2. Retrieve the current date and translate that into a folder name.
    3. Retrieve the reference object.
    4. Modify the reference object and point it to the index page in the folder. Note that this CANNOT be done in the Cascade back-end (the edit option is not available), but this is possible using web services.
    5. Retrieve the referenced object and publish it.

    Code example (note that I am using the library with namespaces):

    $r = $cascade->getAsset( a\Reference::TYPE, $rid );
        $cascade->getAsset( a\Page::TYPE, $page_path, $site_name )

    As for the root index page, I suppose that you can use some sort of page include to include the newest content, like using a page/linkable chooser. Again, this can be switched easily using web services.


  2. 2 Posted by birwin on 02 Jul, 2015 05:16 PM

    birwin's Avatar

    Wing, thanks for your answer, as always, it's appreciated. I need a "Cascade Only" method though, as this site wont be managed by me, and as such wont be using web-services. This will be more of a standalone site, and without any PHP, just flat HTML.

    I was hoping that I could create a reference, to the current "index" page of the month, so when that when I publish the site, essentially, one index page is duplicated. This way I'll always have an up-to-date landing page for the corresponding sections.

    What I need is almost a include statement. The reason I can't copy is because the page level outputs use block which index the current folder, thus copying it to the root will require copied/modified index blocks.

    Thanks for the suggestion though!

  3. 3 Posted by Wing Ming Chan on 02 Jul, 2015 05:26 PM

    Wing Ming Chan's Avatar


    Will you consider Velocity then? Assuming that you can locate a page using its path and grab its contents, you can just display the same contents in the root index page, bypassing references. The only difficult part is to figure out the path of the newest page. But I assume that can be retrieved from an index block.


  4. 4 Posted by birwin on 02 Jul, 2015 05:37 PM

    birwin's Avatar

    Thats kind of what I'm doing now, Im using velocity and have two sets of formats, one for the "current folder" version, and one for the root. The root one cant's use the "current folder" selector as, it is not technically sitting in the current folder. It has to look for the //system-page[name='index'] vs, //system-page[@current='true'] , but also requires the separate index-block which has a specified folder, rather than a relative one.

    I dont want to make a mountain out of a mole hill, was just hoping for something quicker and easier to maintain, but what I've done, may be just that for the time being.

    Thanks again!


  5. 5 Posted by Wing Ming Chan on 02 Jul, 2015 05:42 PM

    Wing Ming Chan's Avatar

    Sorry to go back to the web service option. But as long as you can run PHP code somewhere against the Cascade instance involved, the web service option should still be open. This can be done even on your own computer. I do this at home, writing my library and test programs. The client does not need PHP nor web service script, provided you are willing to do it on your end, like a scheduled job.


  6. 6 Posted by birwin on 02 Jul, 2015 06:08 PM

    birwin's Avatar

    I think having an extra format and index block (which needs to be updated once a month - if that often) is a bit simpler then setting up webservices for this site.

    The issue with webservices is you're tieing your site back to Casacde (which we have restricted access to). Once you do that, we lose the security that a push platform offers. I'm not saying I wouldn't rather a live platform, but for our use case, I think I'll have to stick with what I'm doing.

    I was hoping there was just a flag or something to published the content which the reference is pointing to, in place, where the reference sits.

    Thanks though,



  7. 7 Posted by Ryan Griffith on 02 Jul, 2015 07:45 PM

    Ryan Griffith's Avatar

    Hi Brendon,

    Curious, but could you use two Index Blocks, one of which has a specified folder that is the current year and the other is a contextual index block that indexes the current folder of the calling page (for the yearly landing)? This should allow you to re-use your same Format depending on how you wrote it while keeping the size of your Index Block down. The drawback there is someone will need to adjust the Index Block once a year; however, you could potentially automate that using Web Services.

    Alternatively, you could check the name of the calling page and if it's /index use the Date Tool to obtain the current year and use the Locator Tool to get the children of the current year's folder; otherwise, get the children of the calling page's parent folder.

    Please let me know if you have any questions.


  8. 8 Posted by birwin on 02 Jul, 2015 08:02 PM

    birwin's Avatar

    I think that's the approach I'll have to take. It requires an extra index block which strictly references a given (the current) folder, but that's not the end of the world. This way we can work in another folder, and it wont update until we tell it to.

    I'll look into using the locate folder, but given how things are published ad-hoc that may cause more problems, so this approach might be the best for now. Maybe I'll put a "publish-in-place" flag for references in the idea forum.



  9. Tim closed this discussion on 17 Jul, 2015 02:35 PM.

Discussions are closed to public comments.
If you need help with Cascade CMS please start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac


26 Aug, 2016 01:19 PM
25 Aug, 2016 03:02 PM
25 Aug, 2016 12:50 PM
24 Aug, 2016 08:43 PM
24 Aug, 2016 07:20 PM
21 Aug, 2016 01:20 PM