MODx configuration
$site_name=$modx->config['site_name'];
$site_url=$modx->config['site_url'];
$site_start=$modx->config['site_start'];
$error_page=$modx->config['error_page'];
$base_path=$modx->config['base_path'];
$base_url=$modx->config['base_url'];
$rb_base_dir=$modx->config['rb_base_dir'];
$rb_base_url=$modx->config['rb_base_url'];
$modx_charset=$modx->config['modx_charset'];
Page information
$parentid = $modx->documentObject['parent'];
$pageid = $modx->documentObject['id'];Don't use the following if you want to use php switch and want to parse a modx function inside.
$id=$document['id'];
$pagetitle=$document['pagetitle'];
$longtitle=$document['longtitle'];
$description=$document['description'];
$alias=$document['alias'];$anotherpage = $modx->getDocument(127, '*', 1); // 127 is the page id, 1 is published
$anotherpage['content']; //shows the content
Sessions/User information
$username = $modx->getLoginUserName();
$fullname = $_SESSION['webFullname'];
Snippets
$params['test']=1;
$params['dummy']=2;
$snippet=$modx->runSnippet('snippet_name', $params);
[[snippet_name? &test=`1` &dummy=`2`]]
Chunks
$chunk=$modx->getChunk('chunk_name');
{{chunk_name}}
$params['test']=1;
$params['dummy']=2;
$chunk=$modx->parseChunk('chunk_name', $params, '[+', '+]');
Template variables Updated for Revolution
//@SELECT
@SELECT pagetitle FROM modx_site_content WHERE parent = 329 ORDER BY pagetitle$tv = $modx->getTemplateVar('vouchers', "",$row['id']);
echo $tv['value'];$document_tvs=$modx->getTemplateVarOutput(true, $id);
$templatevar_output=$document_tvs['template_variable_name'];
[*template_variable_name*]
Placeholders
$var=$modx->getPlaceholder('placeholder_name');
$modx->setPlaceholder('placeholder_name', $var);
[+placeholder_name+]
Other functions
$url = $modx->makeUrl(25); // 25 being the page to go to
$modx->sendRedirect($url, 0, 'REDIRECT_HEADER', '301');$tblsc = $modx->getFullTableName('site_content');
// Get MODx documents
$id=$modx->documentIdentifier;
$document=$modx->getParent($id);
$document=$modx->getDocument($id);
$document=$modx->getDocumentChildren($id);
$document=$modx->getActiveChildren($id, 'menuindex', 'ASC');// Make URL
$url=$modx->makeUrl(intval($id));// Make URL in HTML
?>
[~id~]// Send Redirect to the Browser
$count_attempts=1;
$modx->sendRedirect('http://www.newdomain.com', $count_attempts, 'REDIRECT_HEADER', 'HTTP/1.1 301 Moved Permanently');// Forward to a new MODx document without reloading the page
$modx->sendForward($id);…
// Get MODx configuration in HTML
?>
[(site_name)]
[(site_url)]
…// Handle MODx events
$event=$modx->Event;
switch($event->name)
{
case "OnBeforeDocFormSave":
…
break;
}
howdy smart little web page ya got there ;) I use the very same web theme on my website although for whatever silly issue it seems to reload more efficiently on your blog eventhough this site consists of considerably more content. Are you applying any kind of plug ins or widgets which will quicken it up? Do you think you might be able to share the widgets so that I would be able to use these on my own web page so twilight breaking dawn supporters could watch twilight new moon online trailers and videos easier I would be happy – many thanks in advance :)
Hi there may I quote some of the information found in this post if I link back to you?
Yes, sure – these are just notes that I find useful and a place to put them if I forget.
If they help anyone else then great.
I might even get a proper design in here one day.
Which theme is that?
i cant beleive i stumbled onto your post..thanks so much!!! i am going to have to sign up 2 ur RSS feed so i can keep updated with your post…thanks Again
great article…i’ll comeback next Wednesday to read some more…adios
Thanks for taking the time on this, I was looking all over for something similar, but this has proven to be just as helpful.
I had a little trouble understanding right away, but I'm pretty sure I get what meant now. Ta!
Hi, I just tried to email you about this article although can't reach you. Please email myself anytime get a second. Regards.
Article removed. But still posted because of the amusing name the spammer used
Dipping into this article I have found solutions for many problems that have been bugging me for some time now. Its not easy to find accurate articles on the internet as a lot of such texts are written by a person with little knowledge of the topic. Your publication is unique and definitively worth reading. I'll be back articles in few days.
hey great information your site contains will return when I have time to read more.
Hey guy, nice content. You rock!
Very helpful information. Great post, I absolutely enjoy reading your post.
Lastly an outstanding article regarding the subject, keep up the great work and therefore I hope to examine a lot more of your stuff in the future.
Good thorough ideas here.I'd like to recommend checking out such as something like graphic bomb. What exactly are you looking for though?
Hi,thanks for the blog post. Infos are really usefull and saved me a lot time which I could spend on something else instead of searching :) Thanks a lot!
Your article is very good yet little short. I hope you next articles could be little more elaborate that this one. Still good job.
Do you mind post this to one of my websites on this subject? I'd give you full credit, of course. Let me know by email what you think. :)
Yes, of course you can
Your website is valuable for me. Thanks!…
This was extremley useful, thank you.
loved your post. I am gonna have to show this to my (future) bf heh. Hope you're having a good Sunday. – Danielle
Remarkable post, thank you, I will bookmark you!
Excellent piece of writing and easy to fully understand story. How do I go about getting agreement to post component of the page in my upcoming newsletter? Offering proper credit to you the source and weblink to the site will not be a problem.
Some really nice stuff on this web site , I love it.
very useful post. thank you a lot.
You can do anything like that – it'd be nice to get a link back