-
☆ A M B ☆
- 265 Posts
Quick question, which I think I already know the answer to...
Is it possible to have some or all of the Resources and Documents on the server, mainly the Template Resources - I’d like to be able to use a text editing app such as Panic’s Coda and connect to the site via FTP and edit the Templates - then let the client login to the CMS and edit the documents and content.
This is the beauty of other such CMSes like WordPress, where its so easy to go in and amend the templates... At the moment it is possible to have the CSS as a static file on the server or in the database, could I do this with any other file?
MODX Ambassador for Thailand. Managing Director at
Monogon, a web design and development studio based in Bangkok, Thailand. -
Follow me on Twitter.
Interesting, I’ve tried this in the past and didn’t get it to work. I had a page with an e-form snippet in the content area, when I included the template for this page as you have said above( I too wanted it to be external) it didn’t parse the e-form snippet, it just dumped it as a string in the content area. I thought this may be because of nested eval’s or something as the template itself is now being included via an eval, then again I may just have got it wrong somewhere.
Use MODx, or the cat gets it!
-
☆ A M B ☆
- 265 Posts
ah thanks TobyL, I forgot to come back and check this topic, a local MODx friend,
PixillionSaul actually showed me a similar snippet he’d been using:
Snippet name:
<?php
# Snippet to include files from filesystem
# [[includeFile? &file=`assets/templates/mytemplate/file.html`]]
if ( !isset($file) || $file== "" ) return "No file specified."; //check if there's a file given.
//Start the buffer
ob_start();
//include
include $file;
//get contents from the buffer
$ob_contents = ob_get_contents();
//and kill/delete the buffer
ob_end_clean();
//return it to MODx
return $ob_contents;
?>
and then you’d call it like this into one of your templates or something:
[[IncludeFile? &file=`assets/templates/templates.about.htm`]]
MODX Ambassador for Thailand. Managing Director at
Monogon, a web design and development studio based in Bangkok, Thailand. -
Follow me on Twitter.
Just a php question: I would most like have tried doing this with a simple include() but I noticed that both snippets use the output buffer. Would an include not work or be considered ’wrong’?