Include contents from a rendered page

jeberwei's Avatar

jeberwei

17 Aug, 2016 04:48 PM

Hi There,

All of our sites use a common index block and xslt to render an unordered list for a nav file. This file is then used as an include for the website.
We use a common index block so one does not need to be created for every department folder (we have over 300 department folders).
This index block starts at the nav file in a root folder, and indexes everything within.

The issue is that we cannot see the rendered nav file within any page inside Cascade (since it is an include file on the server).

I'm thinking that we need to use velocity to show the contents of the nav file within the folders pages.
Locator tool?
I'm brand new to velocity, so am unsure as how to accomplish this.

thanks for any help you can provide

-Jason

  1. 1 Posted by Wing Ming Chan on 17 Aug, 2016 06:01 PM

    Wing Ming Chan's Avatar

    Hi Jason,

    If you can find a way to include contents from a rendered page so that pages inside Cascade work properly with navs, then when they are published, they should still work on your web server, and there is no need of server-side file include. Are you trying to move away from file include then?

    Navs can be generated for separate sites from a single index block existing in a shared site. Why file include in the first place? In fact, I don't even need an index block to generate navs at all. Using the Locator Tool to collect folder information, you can generate them easily. You can also make the required information available to the calling-page index block attached to DEFAULT of a page and generate the nav in DEFAULT.

    Contents rendered from a page region attached with a block and format cannot be retrieved by the Locator Tool easily (I hope I am right on this point). Assuming that what you mean by "nav files" are in fact pages whose contents are generated in regions, then there is no easy way to make the contents available to other pages. There are ways, but difficult ones.

    I hope this helps.

    Wing

  2. 2 Posted by jeberwei on 19 Aug, 2016 03:35 PM

    jeberwei's Avatar

    We didn't want to write the navigation to each page, since when people change their folder structure, they have to publish their entire website. Because of this. there is a nav file in the root of each department's folder. This is used as an include file once out on the server. If someone changes their site structure, all they have to do is it also publish the nav file, and the navigation updates on every page of their site.

    I suppose I could keep that nav file as is. But then use internal tags to create the navigation for the pages within cascade. I just do not know how to use the locator tool to tell that page to render from the root of that department folder (nor honestly do I know velocity). Trying to find some examples out there on how to accomplish this

    thanks

  3. 3 Posted by Wing Ming Chan on 21 Aug, 2016 01:20 PM

    Wing Ming Chan's Avatar

    Jason,

    I have cooked up something for you. Here is a format to generate a site menu:

    https://github.com/wingmingchan/velocity/blob/master/tutorials/05%2...

    There are a few things you need to know about this format:

    1. It uses the Locator Tool. Check my site for the Cascade API documentation.
    2. I assume that every folder has an index page.
    3. I did not use dynamic metadata to control the menu. You may need to look at dynamic metadata on pages and folders to decide whether to include an asset in the menu.
    4. I used recursion and a number ($level) to control how deep I want to go. You may need to manipulate this number, or rewrite the macro to avoid the use of recursion.
    5. You may not want to start from the Base Folder of a site. Then you have to pick a starting folder.
    6. The format must be made available to every page. You may want to use web services to attach the format to pages.
    7. You can use [system-view:internal] to make the menu available only to Cascade.
    8. I am still working on my Velocity tutorials. Check my site for details.

    Wing

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

Keyboard shortcuts

Generic

? 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