Publish a file without escaping

birwin's Avatar

birwin

05 Apr, 2016 02:19 PM

Hi there, I'm trying to publish a data definition as a php array for use in a script.

I setup a template like so:

<!--#passthrough<?php /* #passthrough--><html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body class="page-body">
<!--#passthrough */ #passthrough-->

<system-region name="code"/>

<!--#passthrough /* #passthrough-->
</body>
</html><!--#passthrough */ ?>#passthrough-->

mapped the code region to my data definition and the format to my velocity script (attached) and configured the configuration set to be a .PHP file with the serialization type as HTML (I also tried CSS).

For the most part it works, but the issue is the PHP code is being encoded, which i do not want. (getting the &gt instead of > ) also the urls are not being converted to the proper urls , they have the site://.

Any help is always appreciated. Thanks!

$array = array(
    
    array(
        "title" =&gt;'Faculty of Arts',
        "link"=&gt;'site://www.wlu.ca/academics/faculties/faculty-of-arts/index',
        "cid"=&gt; 'e2437e070a0a4ab0227deb18d24cbbce',

  1. 1 Posted by Ryan Griffith on 05 Apr, 2016 06:11 PM

    Ryan Griffith's Avatar

    Hi Brendon,

    You should be able to simplify your Template to the following:

    <!--#cascade-skip--><pass-through><system-region name="DEFAULT"/></pass-through>
    

    Then, in your Format simply surround the PHP content inside of #protect-top code sections to push that content to the top of the rendered page content. For additional information, check out my response to this similar discussion which deals with outputting a JSON file. In your case, it's the same setup only you are outputting PHP.

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by birwin on 05 Apr, 2016 06:39 PM

    birwin's Avatar

    Perfect, thanks Ryan.

  3. 3 Posted by birwin on 05 Apr, 2016 06:42 PM

    birwin's Avatar

    Actually, there is one small issue still, the links do not convert into non scade links, they still contain the site:// and no file extension.

        array(
            "title" =>'Faculty of Arts',
            "link"=>'site://www.wlu.ca/academics/faculties/faculty-of-arts/index',
            "cid"=> 'e2437e070a0a4ab0227deb18d24cbbce',
            "children" => array(
                                "title"=>'Ancient Studies',
                "link"=>'site://www.wlu.ca/academics/faculties/faculty-of-arts/department-of-global-studies/index',
                "pid"=>'e2437e070a0a4ab0227deb18d24cbbce'
                             ,
                                    "title"=>'Anthropology',
                "link"=>'site://www.wlu.ca/academics/faculties/faculty-of-arts/department-of-history/index',
                "pid"=>'e2437e070a0a4ab0227deb18d24cbbce'
                             ,
                                    "title"=>'Archaeology',
                "link"=>'site://www.wlu.ca/academics/faculties/faculty-of-arts/department-of-archaeology-and-classical-studies/index',
                "pid"=>'e2437e070a0a4ab0227deb18d24cbbce'
                                 )
        )

  4. 4 Posted by Ryan Griffith on 05 Apr, 2016 07:26 PM

    Ryan Griffith's Avatar

    Hi Brendon,

    In order for the links to be tracked, you will need to surround them with [system-asset] pseudo tags. Note; however, this will produce relative links by default, but you can enable the Maintain Absolute Links option on the page. If you need a fully qualified URL, you will need to append a URL onto the front of the link (before the pseudo tag).

    Please let me know if you have any questions.

    Thanks!

  5. 5 Posted by birwin on 06 Apr, 2016 01:33 PM

    birwin's Avatar

    That did the trick. Thanks Kindly Ryan!

  6. 6 Posted by Ryan Griffith on 06 Apr, 2016 04:59 PM

    Ryan Griffith's Avatar

    Not a problem at all, Brendon. I am glad to hear that 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!

  7. Ryan Griffith closed this discussion on 06 Apr, 2016 04:59 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