What do I need to write to echo (show) one of the CMS pages at the frontend of my website?
Im not a PHP master but is it something about <? include(test.php ?>
I’m not sure exactly what you want... but if you wanted to run that sort of php code you could create a snippet with said code.. and name it "echopage" for instance. then in your MODx document insert [[echopage]] to call the snippet and PHP code.
However if I wonder that’s not really what you’re asking, and you just want to display a page. if that’s the case, it’s all driven from index.php with an id variable. However most installs use the friendly URL option these days.
A problem well stated is a problem 1/2 solved
I just want to get the content from fx. ID 22 and insert the content into page with ID fx. e.g. 1
Was it better explained?
Ahh... you want to include content from one MODx document in another MODx Document.
http://modxcms.com/extras/package/115 Here is a snippet called DynContent we use it often to allow clients to easily edit include areas.
Yeah thats exactly what im looking for.
How do I need to write the ! DynContent?docid=`9` ! on my CMS pages?
I created a snipet with this inserted code and called it: DynContent
<?php
$docid = isset($docid) ? $docid : "";
if(empty($docid)) return "";
$doc = $modx->getDocumentObject(’id’,$docid);
$output = str_replace(array("[!","!]"),array(""),$doc[’content’]); ;
return $modx->parseDocumentSource($output);
?>
And then i entered this on one of my CMS Pages: [[DynContent?docid=`83`]]
But it is not showing anything on the frontend of my website.
Has I done anything wrong?
[[DynContent?var=`value`&var2=`value2`]]
Like that.
Sorry that was just an example of basic snippet syntax.. you had it right a few posts above.
Is the snippet installed? and the snippet name is case sensitive