connect to local computer from android emulator (hosts file)

connecting to something running on your local computer from you android emulator device is something which makes debugging alot easier.

since you can’t connect to localhost or 127.0.0.1 since that is the android emulator itself we need to make sure that the hosts file contains what we need.

to make this possible you need to start your AVD with the -partition-size parameter so we can actually change the system stuff (maybe try 512 if that still doesn’t work):

emulator -avd myAVDName -partition-size 256

afterwords we need to remount the system partition to make it writable:

adb remount

since the computer running the AVD can be called through IP 10.0.2.2 we’ll create a hosts file locally for example:

127.0.0.1	localhost  
10.0.2.2	myawesomewebsite
10.0.2.2	andanothervirtualhost

now we need to push this file onto the AVD:

adb push /path/to/hosts /system/etc

and open a browser and check if http://myawesomewebsite works

woohoo!

wcmsblog for phpwcms 1.3.3

well i’ve seen lot’s of people having problems with this and since i’m setting up a new phpwcms 1.3.3 and need blog support i’ll describe how i’m getting wcmsblog to run.

well after downloading from the site, looked at the contents of the archive. this includes:
include/
phpwcms_template/
scripts/
blogrss.php

the include directory and blogrss.php file can be moved into your phpwcms without any worries. notice that the new default directory for the templates does not have the “phpwcms_” prefix anymore! so move the containing files into the template folder of phpwcms.
now, i don’t like the idea of having even more javascripts laying around than there already are, but for making this easy, just copy the scripts folder with moo.fx and prototype over too. (i might change this since prototype and libraries similar to moo.fx are already laying around in phpwcms 1.3.3)

well on to the next step, now open phpwcms.php and at line 96 look for
case "modules": //modules

at line 105-106 the part for the graphical text mod is done, right below this add
$subnav .= subnavtext("Blogs", "phpwcms.php?do=modules&p=6", $p, "6", 0);
make sure you don’t have another module using the ID 6 or else change it.

and around line 403 ( since you’ve added a line or two it could be around 405 ;) ) after the graphical text mod part (ca. 408-410) add
if ($p == 6) { // Blog MOD
include_once "./include/inc_module/mod_blogs/main.inc.php";
}

NOTE: that the ID has to be the same as above if you changed it.

now if you log into phpwcms under modules you have a working version of the wcmsblog backend, hopefully!
the database is created the first time you enter the “Blogs” module.

if you are not using the GT mod, make sure you open the file blog.module.php in template/inc_script/frontend_render and look for
$s = preg_replace('/\{GT:(.+?)\}(.*?)\{\/GT\}/ei', "get_gt_by_style(\$gt, \"\$1\", \"\$2\")", $s); this should be around line 215.

here replace the line with an “if” to check if the gt mod classes exist, like this
if(class_exists('get_gt_by_style')) {
$s = preg_replace('/\{GT:(.+?)\}(.*?)\{\/GT\}/ei', "get_gt_by_style(\$gt, \"\$1\", \"\$2\")", $s);
}

if your GT mod is enabled and in use (added fonts and writable gt folder for images) you shouldn’t need to do this, but it’s needed if you don’t use the GT mod, just enabling in the config file doesn’t work!

now add the replacement tag to an article {BLOG:yourblogname} and it should show up in the frontend!

i’ll be showing you how to get the captcha working soon… if you have question feel free to ask!