Publish a file without escaping
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 > 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" =>'Faculty of Arts',
"link"=>'site://www.wlu.ca/academics/faculties/faculty-of-arts/index',
"cid"=> 'e2437e070a0a4ab0227deb18d24cbbce',
- data_Definition_XML.txt 492 Bytes
- velocity_macro.txt 1.03 KB
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
1 Posted by Ryan Griffith on 05 Apr, 2016 06:11 PM
Hi Brendon,
You should be able to simplify your Template to the following:
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 Posted by birwin on 05 Apr, 2016 06:39 PM
Perfect, thanks Ryan.
3 Posted by birwin on 05 Apr, 2016 06:42 PM
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 Posted by Ryan Griffith on 05 Apr, 2016 07:26 PM
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 Posted by birwin on 06 Apr, 2016 01:33 PM
That did the trick. Thanks Kindly Ryan!
6 Posted by Ryan Griffith on 06 Apr, 2016 04:59 PM
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!
Ryan Griffith closed this discussion on 06 Apr, 2016 04:59 PM.