create link of parent folder

karen.wilson's Avatar

karen.wilson

19 Mar, 2015 04:39 PM

I'm trying to create a link to the index page in the first level folders in a site. Example below:
Page - /ace/programs/bba
Link to be added to this page - /ace/index
OR
Page - /ace/staff
Same link
OR
Page - /ace/scholarships/compsci/index
Same link

I'm using an index block that renders current page with hierarchy. I'm not having much luck. Can you point me to an example or provide any help? Thanks.

  1. 1 Posted by Ryan Griffith on 19 Mar, 2015 05:30 PM

    Ryan Griffith's Avatar

    Hi Karen,

    When you have a moment, please attach your Format and sample XML so I can take a look at where you are at and do some local testing.

    To get the sample XML, edit your Format and select the appropriate Block and context Page within the Preview Options section at the top.

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by karen.wilson on 19 Mar, 2015 06:24 PM

    karen.wilson's Avatar

    Do I just copy the format and xml into something like notepad and then attach it as a .txt?

    Karen Wilson
    Web Designer
    Southwestern Oklahoma State University
    (580) 774-6147
    [email blocked]<mailto:[email blocked]>

  3. 3 Posted by Ryan Griffith on 19 Mar, 2015 07:08 PM

    Ryan Griffith's Avatar

    Yup, you got it, Karen. You could also make them .xml files if you wish. Either file type will work just fine.

    Thanks!

  4. 4 Posted by karen.wilson on 19 Mar, 2015 07:23 PM

    karen.wilson's Avatar

    I don’t know what to add to the {path} to select the right folder.

    Karen Wilson
    Web Designer
    Southwestern Oklahoma State University
    (580) 774-6147
    [email blocked]<mailto:[email blocked]>

  5. 5 Posted by Ryan Griffith on 19 Mar, 2015 07:47 PM

    Ryan Griffith's Avatar

    Thank you for attaching the files, Karen.

    So to confirm, the link should always point to the top level folder for the calling page? If so, I think the following should do the trick:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
        <!-- Define our output preferences -->
        <xsl:output indent="yes" method="xml"/>
        <xsl:template match="/system-index-block">
            <xsl:variable name="rootFolder" select="system-folder/system-folder" />
            <div class="band">
                <a href="{$rootFolder/path}/index">
                    <xsl:value-of select="//system-page[@current = 'true']/description"/>
                </a>
            </div>
        </xsl:template>
    </xsl:stylesheet>
    

    Please let me know if you have any questions.

    Thanks!

  6. 6 Posted by karen.wilson on 19 Mar, 2015 07:51 PM

    karen.wilson's Avatar

    Perfect! Thanks.

    Karen Wilson
    Web Designer
    Southwestern Oklahoma State University
    (580) 774-6147
    [email blocked]<mailto:[email blocked]>

  7. 7 Posted by Ryan Griffith on 19 Mar, 2015 07:53 PM

    Ryan Griffith's Avatar

    Not a problem at all, Karen, thank you for following up. I am glad to hear my suggested code did the trick.

    I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.

    Have a great day!

  8. Ryan Griffith closed this discussion on 19 Mar, 2015 07:53 PM.

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