Tuesday, August 30, 2011

My answer to "Is there any way to include images in my post?"

This is my answer to a Question on Support site for LampCMS project


There are some posts with images on this site. I am not sure how they did it. There is no support to actually save an image to the server but there is a way to just include an img tag that points to image hosted somewhere else. 

Monday, August 22, 2011

My answer to "Sitemap Generation."

This is my answer to a Question on Support site for LampCMS project


OK, I figured out the problem. The SiteMap class needs this constructor.
Add it to the SiteMap class and it will work. Keep using the factory method that I posted before.


public function __construct(Registry $o){
                $this->oRegistry = $o;
        }

Sunday, August 21, 2011

My answer to "Lampcms Write API"

This is my answer to a Question on Support site for LampCMS project


TO use WRITE API you need to make POST request to API and also pass basic authentication in headers.

This is how to do this from php using curl: (replace with your own existing question id, replace with your own url, use your own username and password)

$aInputs = array(
'a' => 'addanswer',
'qbody' => 'bbb body of answer here again!', 
'qid' => '631');


try{
        $oCurl = new \Lampcms\Curl();
        $oCurl->setBasicAuth('user2', 'test123');

        $oCurl->getDocument('http://127.0.0.5:88/api/api.php', null, null, array('formVars' => $aInputs, 'redirect' => 4));

        $body = $oCurl->getResponseBody();

        echo ' body: '.$body;

} catch (\Exception $e){

        $info = $oCurl->getCurlInfo();
        echo 'INFO: '.print_r($info, 1);

        if($e instanceof \Lampcms\HttpRedirectException){
                $newUrl = $e->getNewURI();
                get_page($newUrl, $info['url']);
        }
        $s = 'E: '.$e->getMessage().' in '.$e->getFile().' on '.$e->getLine();
        exit($s);
}


My answer to "Sitemap Generation."

This is my answer to a Question on Support site for LampCMS project


Try this:
In sitemap.php change line 49 to this:

$o = \Lampcms\SiteMap::factory($oRegistry);

My answer to "Lampcms Write API"

This is my answer to a Question on Support site for LampCMS project


Sounds like you need import script, not a write API. I agree that it would be very useful to have import scripts to import from other forums like from existing phpbb or vbulletin or any other type of forum.

If anyone is interested in import scripts then let's start a separate discussion. I will need sample database dumps so I can at least start working on those scripts.

As for Write API - I agree that there is not much documentation at this time but you can ask specific question and I will answer it.

Read and write APIs are actually fully functional and support basic authentication (username and password in http headers).

Sunday, August 14, 2011

My answer to "Do you recommend any specific host?"

This is my answer to a Question on Support site for LampCMS project


I don't recommend any hosts. That's because I don't know any hosts other then my current host.

Basically it does not matter what host it is. The program does not care about it. It just needs php 5.3+ and MongoDB and optionally MySQL.

I always recommend to get a dedicated server where you have full control of it and can install MongoDB, php and php mongodb extension yourself. It's does not matter what host. I am looking for a new host myself. I am looking for an inexpensive server with 2 hard drives and 8 Gigs of ram and CentOS as operating system. That's because I have experience with CentOS. CPU speed is not very important to me.Any Linux flavor is fine, it runs on Windows too. I actually developing this program on Windows 7 at home.

One thing is important - the operating system must be 64 bit so that you can use 64-bit MongoDB version. 32-bit MongoDB has severe limitations as far as maximum size of repository.

You don't need 8Gigs normally, I just expect to host several instances of this program on it, different Q&A sites.



Wednesday, August 10, 2011

Another update, more translations in XLIFF file

My Question on Support site for LampCMS project

Just pushed another update to github

Fixed a bug that prevented new registrations. It had to do with the new translation module. It works now.

Also added more translation strings to the russian translations file. It's in /translations/messages.ru.xlf
It now contains 92 translated strings.
This file should be used as template for translating this site into any other language or other locale.

All you have to do is copy that file to messages.fr.xlf (if you translating into French for example), then just replace all russian strings with French translations - keep the original English strings unchanged.

I think there are about 70 more strings left to translate, including all messages that are sent by email like after the registration, after the password changed, etc.

By the way, translation objects are cached for best performance. So if you add or update the translation .xlf file you need to clear cache. I just added the new controller for that.

If you logged in as administrator you will see a new link "Clear Cache" in "Settings" Just click on it and it will remove all data from cache. This is safe to do and not a big deal, new files will be re-generated and cached as needed.

One extra bonus is that now the ACL object (access control) is also cached and it usually saves about 5-10 milliseconds because it's no longer required to read acl.ini file to generate the ACL object. If you added new permissions or edit acl.ini file you will also need to clear cache.

My goal is of cause to have all strings on the site to be accessed via Translator object, no hard-coded strings should be left on the site.

Anyways, you can get to latest from github as usual.

I'm not planning any more major features, maybe only one more - "whose online" feature, you know, to show whos' currently online and possibly what they are doing - like reading this question, viewing tags, asking question and stuff like that.

Click here to post your reply


Sunday, August 7, 2011

My answer to "Is there any way to include images in my post?"

This is my answer to a Question on Support site for LampCMS project


There are some posts with images on this site. I am not sure how they did it. There is no support to actually save an image to the server but there is a way to just include an img tag that points to image hosted somewhere else. 

Wednesday, August 3, 2011

Translation/Locale Xliff based module is done

My Question on Support site for LampCMS project

Hello!
I know it has been a long time since the last post. I am very busy these days and only have several hours a week to work on this project.

I finally finished the Translation module for this site. Translation module is done using Xliff standard. I'm sure you can Google it if you don't know what it is.

The code is in the latest commit on github

So far I have translated 52 strings (there has gotto be at least as many left to translate) into Russian language.
I don't know any other languages and even my Russian is rusty.

You can test it by selecting Russian from the drop-down menu at the bottom of this site.

Anyway, the Russian translations file is a good example of how you can translate this site into any other language.

You need to just copy the file from /translations/messages.ru.xlf into your own language and save the new file as /translations/messages.fr.xlf (if you going to be using French)

You can also use Locale-specific translations, for example messages.en_GB.xlf

Remember that .xlf files are xml files and must be a valid xml.

If you want to contribute your own translations just send me a copy of your own .xlf translation file.

To add more language options to your site add more locale choices to your config.ini file
There is now a [LOCALES] section in it.

Add something like this:

[LOCALES]
en_US = "English (United States)"
en_GB = "English (United Kingdom)"
fr_FR = "French"
fr_CA = "French (Canadian)"
de = "German"
es = "Spanish (Spain)"
ru_RU = "Russian"

These will become the choices in the drop-down menu at the bottom of the pages.

Click here to post your reply