Thursday, August 19, 2010

Modx 1.04 Event Sequence

List of events in sequence
- OnBeforeManagerPageInit (DocumentParser::getSettings), if is manager
- OnWebPageInit (DocumentParser::executeParser)
- OnLogPageHit (DocumentParser::executeParser), if track_visitors is on
- OnLoadWebPageCache (DocumentParser::prepareResponse)
- OnLoadWebDocument (DocumentParser::prepareResponse)
- OnParseDocument (DocumentParser::parseDocumentSource)
- OnWebPagePrerender (DocumentParser::outputContent)

Wednesday, August 18, 2010

Double action (GET & POST) posted! Modx Manager

When you encounter this type of error, its due to the specification of
query-string and post form with "a" parameter

Monday, August 2, 2010

Modx ChangePwd Chunk sample

<div id="divChangePassword" style="position: relative; display: none;">
<form method="POST" name="changepwdfrm" action="[+action+]">
<input type="hidden" name="cmdwebchngpwd" value="1" />
<input type="hidden" name="passwordgenmethod" value="spec" />
<input type="hidden" name="passwordnotifymethod" value="e" />
<div><label for="oldpassword">Existing Password</label><input type="password" name="oldpassword" /></div>
<div><label for="specifiedpassword">New Password</label><input type="password" name="specifiedpassword" /></div>
<div><label for="confirmpassword">Retype Password</label><input type="password" name="confirmpassword" /></div>
<input type="submit" value="Save" />
</form>
</div>

Some useful way to get ip and computer name via php

To get the user’s IP use the following script:
phpGetHostByName($REMOTE_ADDR);

To get the user’s computer name use the following script:

phpgethostbyaddr($_SERVER['REMOTE_ADDR']);

Sources:

Friday, July 9, 2010

Disabling captcha when captcha is not being display

update `modx_system_settings` set setting_value='0' where setting_name='use_captcha';

Tuesday, June 29, 2010

Alfresco installation: installing pdf2swf

For redhat / rpm based distribution:
yum install zlib-devel libjpeg-devel giflib-devel freetype-devel gcc gcc-c++

For debian / ubuntu / apt based distribution:
sudo apt-get install zlib1g-dev libjpeg-dev libgif-dev libfreetype6-dev

./configure

make

sudo make install

Monday, June 7, 2010

URL Rewrite for alias with parameter

When we need to redirect certain alias to another url,
we can modify htaccess file to handle redirection with the code below:

Example: redirect blabla to /articles/index
RewriteRule ^blabla(/)? /articles/index$1 [R,L]
The above work if our url goes:
http://www.example.com/blabla or http://www.example.com/blabla/

If we may have sub folders within bla bla or need to pass in additional parameter (as common in zend framework):
RewriteRule ^blabla(/)?(.+)? /articles/index$1$2 [R,L]
The above work if our url goes:
http://www.example.com/blabla/page/2/xyz/aaa
to
http://www.example.com/articles/index/page/2/xyz/aaa