Options +SymlinksIfOwnerMatch RewriteEngine On RewriteBase / RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC] RewriteRule .* - [F,L] RewriteRule ^(manager|assets)/*$ - [L] RewriteRule \.(jpg|jpeg|png|gif|ico)$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] Options +SymlinksIfOwnerMatch RewriteEngine on RewriteCond %{HTTP_HOST} ^domain.com [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301] <Files *.html> SetOutputFilter DEFLATE </Files>
Options +SymlinksIfOwnerMatch RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] <Files *.html> SetOutputFilter DEFLATE </Files>
What you could do is to use absolute paths for styles, js and img, and wahtsnotall you miss.
<?php if ( !isset($phpfile) || $phpfile == "" ) return "No file."; ob_start(); include $phpfile; $ob_contents = ob_get_contents(); ob_end_clean(); return $ob_contents;
Quote from: pureppl at Jun 07, 2011, 08:01 PM
What you could do is to use absolute paths for styles, js and img, and wahtsnotall you miss.
yes, is work with absolute path...but general problem is when i try Include snippet for the template because i want to edit my template remote like static .html file
maybe the problem is it in IncludeFile:
<?php if ( !isset($phpfile) || $phpfile == "" ) return "No file."; ob_start(); include $phpfile; $ob_contents = ob_get_contents(); ob_end_clean(); return $ob_contents;
but i can`t see in code something for path...
Just to understand that: In the template you do
[[includeFile? &phpfile=`sun/estemplate.html`]]
and `sun/estemplate.html` means a relative path, relative to the root-directory of the subdomain?
<?php if (empty($phpfile)) return 'No phpfile.'; $subdomainPath = $modx->getOption('subdomain_path', $modx->context->config, false); if (empty($subdomainPath)) return 'No setting subdomain_path.'; $path = $subdomainPath.$phpfile; if(!file_exists($path)) return 'File not found.'; ob_start(); include($path); return ob_get_clean();
Now i undersand what you want to do.
First of all: Including remote files via php core function include is very very very bad practise, its like creating an open door for security issues of all kinds. You should never ever do this. One exeption: You do absolutly know what you are doing and what the implications are.
Back to Topic:
One way can be:
<?php if (empty($phpfile)) return 'No phpfile.'; $subdomainPath = $modx->getOption('subdomain_path', $modx->context->config, false); if (empty($subdomainPath)) return 'No setting subdomain_path.'; $path = $subdomainPath.$phpfile; if(!file_exists($path)) return 'File not found.'; ob_start(); include($path); return ob_get_clean();
If you are using this snippet, create a subdomain_path key in Context Settings with the value setted to the full filesystem path on the server to the root-directory of the subdomain (the directory where the .htaccess of your subdomain is). Dont set subdomain_path to a remote directory like http://mysub.domain.com/
EDIT:
I would not do it that way i would edit my templates via the modx-manager and a editor like codemirror (there is a package for codemirror in packet manager)