Page 1 of 1
[Solved] Where can I store some xml or xsl ?
Posted: Wed Sep 13, 2006 2:48 pm
by fredt
I'd like to store some xml/xsl files in CMSMS - and then access them from a user defined tag, to deliver some clean page to the user.
I can't find a nice place to store this.
- through File manager (or ftp) : works, but can't be edited, no permissions...
- in an html blob : I have to go to Source and paste the file - then it breaks all crlfs when coming back to wysiwyg, it looks ugly and I still can't edit it... Same in a page.
- in a User Tag would require to Echo everything...
Is there a way to achieve this ? Having some "Raw Content" Page type with no editor ?
Thanks in advance for your ideas !
Using r0.13 on Uniform distro (Apache 2, php5, mysql5).
[3/4 solved] Re: Where can I store some xml or xsl ?
Posted: Thu Sep 21, 2006 8:01 am
by fredt
So, I think I'm on the way solving this.
I've created a template with only:
Code: Select all
<?xml version="1.0"?>
{content block="xml" wysiwyg="false"}
When I edit a page attached to this template, I'm getting
two edit boxes - the standard one with wysiwyg, and a new plain & raw one.
So I can put my xml in there.
As I want to use this xml in a user tag, I coded (not finished !) :
Code: Select all
//dsp_faq Tag
//Takes 2 params, xmlfaq and xsl
// Load the XML source
$xml = new DOMDocument;
$objContent = ContentManager::LoadContentFromAlias($params['xmlfaq']);
$pagecontent = $objContent->GetPropertyValue('xml');
$xml->loadXML($pagecontent);
//not yet done, same mechanism - now gotten from the filesystem
$xsl = new DOMDocument;
$xsl->load($params['xsl']);
// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
echo $proc->transformToXML($xml); //and we're done
Which I call with
Code: Select all
{dsp_faq_tech xsl='tests/faq1.xsl' xmlfaq='XML1'}
And... it works.
But I still have
2 edit boxes when editing the page. How can I have
only 1, in raw (non wysiwyg mode) ?
I've tried
{content block="content_en" wysiwyg="false"} --> duplicates the content_en box & content
{content block="content" wysiwyg="false"} --> creates a new "content" box
{content wysiwyg="false"} --> shows the standard edit box with wysiwyg
Having
{content block="xml" wysiwyg="false"}
{content}
shows both edit boxes, but the standard Content is still first.
I'm still using 0.13 - can this create the problem ?
Re: [3/4 solved] Where can I store some xml or xsl ?
Posted: Thu Sep 21, 2006 8:15 am
by Dr.CSS
Sorry but it will always default to have a content box from the {content} tag which should be on every page because every page is expected to have content, it is looking for you to input something there.
Have you tried to put your .xml in it and use the wysiwyg="false" or you can just use the source button to input it?
Re: [3/4 solved] Where can I store some xml or xsl ?
Posted: Thu Sep 21, 2006 12:27 pm
by fredt
Waow, Mark, Mr {content} tag himself !
I've tried to set wysiwyg="false" on {content}, but didn't find the correct syntax to achieve this. I'll gratefully welcome a working sample for this.
Entering xml in the source turns it into garbage... that's why I turned to special Content field.
Re: [3/4 solved] Where can I store some xml or xsl ?
Posted: Thu Sep 21, 2006 9:36 pm
by Dr.CSS
From the Help of content... so it looks like you will have to use the {content block="xml" wysiwyg="false"} and just not put anything in the {content}, hopefully you are the only one working on this page.
What are you using this for?
What parameters does it take?
* (optional)block - Allows you to have more than one content block per page. When multiple content tags are put on a template, that number of edit boxes will be displayed when the page is edited.
* (optional)wysiwyg (true/false) - If set to false, then a wysiwyg will never be used while editing this block. If true, then it acts as normal. Only works when block parameter is used.
* (optional)oneline (true/false) - If set to true, then only one edit line will be shown while editing this block. If false, then it acts as normal. Only works when block parameter is used.
* (optional)assign - Assigns the content to a smarty parameter, which you can then use in other areas of the page, or use to test whether content exists in it or not.
Re: [3/4 solved] Re: Where can I store some xml or xsl ?
Posted: Thu Sep 21, 2006 10:03 pm
by fredt
fredt wrote:
I've created a template with only:
Code: Select all
<?xml version="1.0"?>
{content block="xml" wysiwyg="false"}
When I edit a page attached to this template, I'm getting
two edit boxes - the standard one with wysiwyg, and a new plain & raw one.
Well, I had read the Help already... I currently have my "xml" raw edit box, but it also displays the standard box. I'd by far prefer having only one edit box.
As the standard Content is saved to db under "content_en", I tried calling my new box "content_en", but then it behaves in a strange way, showing 2 edit boxes with duplicate content. I think the system should detect we "forced" a second [or third ?] block with same name and use this "specific" one as the one to render, rather than the "standard" one. I think I'm going to submit this as a feature request... or hack it in my current code.
Unless one of you guys has a solution ?
Re: [100% solved] Where can I store some xml or xsl ?
Posted: Fri Sep 22, 2006 9:59 pm
by fredt
So I finally hacked it on my version...
And although I'm not a programer, I succeeded, which definitively proves CMSMS is super-well-architectured-and-written !!!
My patch:
- corrects content_en box appearing twice if the template has both {content} and {content block="content_en" }: [content_en] just appears once, at the place defined
- allows wysiwyg=false for {content_en} - so you can have only {content block="content_en" wysiwyg="false"} in the template
- while being there, I added a new optional parameter : "label", so I at last can have
Code: Select all
{content block="content_en" wysiwyg="false" label="Enter your xml here"}
So I'll use this in my User Tag
$objContent = ContentManager::LoadContentFromAlias($params['xmlfaq']);
$pagecontent = $objContent->GetPropertyValue('
content_en');
I'm going to post this patch in the Programers Section...