some concrete5 tricks

Some time ago I was asked a question (through the form you see on the right). Here is the question:

hello, so i tried setting up some new functions in C5, including a breadcrumb and a more "blog like" interface .. both of them come up with parsing errors, it must be that i’m not implementing the code correctly.

here is what i found,


<h3><?= $c->getCollectionName() ?></h3>
<div id='blog-envelope-information'>
Posted by <?= $c->vObj->Version($c, $cvID = "ACTIVE", $extended=true)->getV
ersionAuthorUserName() ?>
at <?= $c->vObj->Version($c, $cvID = "ACTIVE", $extended=true)->getVersionD
ateCreated('Y') ?>
</div>

i assumed that creating a "blog.php" in my themes folder and with the h3 & div tags it would work fine but i still get errors.. i’m really confused, and could use a pointer if you have a sec. thank you.

[Read more]

Leave a Comment

concrete 5.3.0 review – new experience

Yesterday, I’ve downloaded and tried the latest version of concrete5, which is 5.3.0 at the moment. I just used it for one of my latest projects (I’m helping my cousin to set her website, she is an interior designer).
[Read more]

Leave a Comment

Blank page in CMS Made Simple admin

Hello everybody! I finally recovered from the illness and can work as before. Here is my first after-illness post.

Recently I faced with the following problem:

I transfered CMS Made Simple from one host to another. Made everything correctly: updated config files, etc. But admin page started to show nothing, i.e. I always got blank page when attempted to access admin area.
[Read more]

Comments (3)

javascript prependChild

You might know appendChild method which allows you to add an element to the end of another. Like this:


someParentObject = document.getElementById("someid");
...
someChildObject = document.createElement("div");
someChildObject.innerHTML = 'Content';
// append the someChildObject to the end of someParentObject
someParentObject.appendChild(someChildObject);

But what to do if you want to add the child object to the very beginning of parent object? I noticed many people are searching for prependChild method. Strange, but… there is no such method.:) Yet there is another trick:


someParentObject.insertBefore(someChildObject,someParentObject.firstChild);

I hope it will help anybody.;-)

UPD. Thanks for people, who noticed my mistake. Of course I was thinking about insertBefore, not appendChild.

Comments (3)

Introducing Ask Me a Question form

I’ve integrated a new feature in my blog. Everybody can ask me a question and get an answer in this blog.

Of course, this form is mostly for common questions, so everybody can benefit from reading the answer right in a blog post.
By “common questions” I mean the questions that are interesting at least for several people.

I often receive questions by email. I try to answer all of them, but unfortunately my time is limited, so I decided to make the form to:
1) save my time: I will not have to answer the same questions several times;
2) help people searching for answers over the web;
3) make this blog more alive;
4) learn something new and help others learn something new.

You are welcome to answer any questions related to web development, concrete5 cms, fifa manager 09 and other.

Leave a Comment

free concrete5 theme: inove

I’m glad to introduce a new concrete5 theme: inove. This theme is a very popular one among wordpress users. There are over 70,000 downloads and this number is still growing. Most of the people like this theme, so we think it will be a success among concrete5 builders as well.

The theme has right sidebar and nice navigation bar. Installation is easy.

See more details here: http://www.smartwebprojects.net/concrete5-design/inove-theme/

Leave a Comment

customizing sitemap.xml in concrete5

I had to customize sitemap.xml for my concrete5 to suit my needs. You might find it useful I hope.

So, the first problem is that change frequency for all pages defaults to ‘monthly’. There are 2 ways to solve this problem:

If you want to change ‘monthly’ to another value (for example, ‘weekly’) for all pages, the best solution is to simply hardcode ‘concrete/jobs/generate_sitemap.php’:


if ($changefreq == '') {
$changefreq = 'monthly';
}

Change the variable to whatever you like: ‘yearly’, ‘monthly’, ‘weekly’, ‘daily’ or ‘hourly’. Of course it’s better to use the real change frequency.

If you want to have the ability specifying custom change frequency page-by-page, you should create page attribute: ‘sitemap_changefreq’

Go to c5 Dashboard, then open ‘Page Types’ and click ‘Add attribute’ button :

Handle – sitemap_changefreq
Type – Select menu
Searchable? – No
Name – Sitemap.xml change frequency
Values (one by line):
always
hourly
daily
weekly
monthly
yearly
never

When ready, click ‘Add’. Now you can open ‘Properties’ for a page, select ‘Sitemap.xml change frequency’ in ‘Custom fields’ dropdown and set desired change frequency.

The same with priority field. Here is the code in ‘concrete/jobs/generate_sitemap.php’:


if ($priority == '') {
$priority = '0.5';
}

The handle of the custom page attribute should be sitemap_priority. You can leave the field as text or select dropdown with some predefined set of values (for example, I’ve added select with values 0.0,0.1,…,1.0)

The next problem I faced with is that by default concrete 5 cms adds some pages to sitemap that I don’t like to be present there. Such as:

/download_file
/login
/index.php?cID=1 (duplicate of /)

I’ve added the following code in ‘generate_sitemap.php’:


$exclude_urls = array(
'http://www.mydomain.com/index.php?cID=1',
'http://www.mydomain.com/login',
'http://www.mydomain.com/download_file'
);
if (in_array($cPath,$exclude_urls))
continue;

Just before


if ($changefreq == '') {
$changefreq = 'monthly';
}

Finally, my sitemap.xml seems to look exactly like I want it.

P.S. If anybody doesn’t know how to generate sitemap.xml with concrete5: Go to Dashboard, then to Maintenance, and click Run checked (make sure appropriate task is selected)

Comments (3)

Just another concrete5 template – oriental

Converted another wordpress theme for concrete5 cms.

oriental theme for concrete5

oriental theme thumbnail

The oriental template should be nice for concrete 5 users having websites with simple structure.

To install the theme, follow instructions specified in README.txt file inside ‘themes/oriental’ directory.

If there are any problems with the theme, just contact me.

Theme URL: http://www.smartwebprojects.net/concrete5-design/oriental-theme

Leave a Comment

Fifa manager 09: tactics, training and atmosphere

Many players, especially newbies, face with a low energy problem in FIFA manager 09. Below, I’ll try to list some tips and tricks I gathered through my own experience. I’m playing 3D match mode, so if you are a text mode fan, the tips might not work for you.

The first rule is to choose your favorite scheme and select players for the formation. My favorite is 3-5-2 (3 central defenders, 2 defensive midfielders, left and right midfielder, attacking midfielder and 2 strikers). Choose the best players in your squad for each position. You should take into your consideration:
1) potential (get rid of low-talented persons);
2) age (choose a younger person if competitors are equal in playing level, sell the older person);
3) promise (if you promised somebody to be in a starting eleven, you should either choose him number one or sell him).

Then, for each position sign a youth player (preferrably with a good talent level). All in all, you should have about 18-20 players, not more. Otherwise, you will have problems trying to give all of them a game practice. In my Benfica squad there are 19 players: 2 goalkeepers (I signed a youth player because of his talent level and because my main goalee is over 30 years old, if your goalkeeper is not old you might not need even a reserve goalkeeper as you can move a youth player to your squad temporarily in case your goalee gets injured), 5 central defenders (in fact, the main 3 defenders are playing most of the games and 2 youth players are subbed-in or play in cup matches against weak teams), 3 defenisive midfielders (1 experienced and 2 young are rotating), and 5 midfielders (some can play several positions) and 4 strikers (1 is loaned in by previous manager and will not be bought at the end of the season). The strikers should be all good enough for your championship, because if any forward doesn’t score for a lot of minutes, he will lose confidense.
You should always remember that you should have as many players as you really need, not more. Otherwise, you’ll have serious problems with atmosphere, players’ trust and morale.

The other reason why you should have as little players as possible is the teamwork factor. To my experience, it plays an important role in FIFA manager 2009. In fact, having the same line-up for every match can bring you a significant benefit. Of course, you can remind me about low energy problem, so let’s get back to it.

In fact it’s very easy to keep energy in acceptable values above 80 points or so. I do it the following way:

Train fitness only during pre-season. Play 3 friendlies, not more. Rotate players on friendlies. Don’t set training sessions higher than ‘Normal’ for players with energy level below 90.

Every sunday and after every match I go to training groups and sort players into groups by energy (predefined filter), so the first group will contain the most fatigue players, the second will have fresher players, and the rest group will have the fresh players (usually the ones sitting on the bench during the match)

If the lowest energy level in the first group is below 80, the training sessions intensity should show ‘Regenerative’: Focus on tactics and mental skills, have physical skills on 5% and outfield skills on 5-10%. Exclude fitness sessions if players fitness is above 95 (ideally, fitness should be trained up to 99 level during pre-season).

In the second group set the intensity level to ‘Friendly’. Physical skills not more than 10%.

In the third group you can set more physical and outfield sessions to have ‘Normal’ level, but the ‘Friendly’ is better, especially if the players are not 100% fresh even in the third training group.

In all groups you should have 10% for ‘No training’ and 10-15% for ‘Recovery’.

Be patient, you won’t have all tactics learned quickly. I spent about half of the season training Benfica in the way described above. But it worth of it: I have no defeats yet, the atmosphere is great and average energy level is 85-90.

You should try to set different training sessions every week so your players don’t get bored and atmosphere keeps good.

Atmosphere is very important for your team. Set one players’ party every month (don’t set more as it can give you even some negative effect). Go to restauraunt sometimes (I usually go about 1 time per month)

As for tactics. I use individual orders for each player, optimize the task for each player, but keep the whole picture in mind. I use individual tasks, but at the same time, I have commitment set to medium, so the players can have enough freedom for their creativity.

Comments (12)

Installing Apache, PHP, MySQL

Installing apache, php and mysql on ALT Linux

I’ve installed ALT Linux Lite on my laptop because windows XP worked very slow there (my laptop is outdated :)). When I decided to install apache there, I got some problems. This post is for people who have troubles with gcc on ALT linux.

Here is the error I got when tried to configure Apache with configure command line:

configure: error: in `srclib/apr`:
configure: error: C compiler cannot create executables
See `config.log` for more details.
configure failed for srclib/apr

I’ve search around the web looking for solutions for similar problem. The solution is to find and install some rpms to make the gcc compiler work. Here are the rpms you should find:

binutils-2.13.90.0.4-alt2.i586.rpm
cpp2.96-2.96-alt3.i586.rpm
gcc2.96-2.96-alt3.i586.rpm
glibc-devel-2.2.6-alt0.6.i586.rpm
kernel24-headers-2.4.20-alt5.i586.rpm
kernel-headers-common-1.0-alt2.noarch.rpm
libbfd-2.13.90.0.4-alt2.i586.rpm
update-alternatives-1.8.3-alt1.noarch.rpm

Then I began installing them (switched to root user with `su` command):

# rpm -i update-alternatives-1.8.3-alt1.noarch.rpm
# rpm -i cpp2.96-2.96-alt3.i586.rpm
# rpm -i kernel-headers-common-1.0-alt2.noarch.rpm
# rpm -i kernel24-headers-2.4.20-alt5.i586.rpm
# rpm -i glibc-devel-2.2.6-alt0.6.i586.rpm
# rpm -i libbfd-2.13.90.0.4-alt2.i586.rpm
# rpm -i binutils-2.13.90.0.4-alt2.i586.rpm
# rpm -i gcc2.96-2.96-alt3.i586.rpm

You might need to search for another rpms if you get any conflict installing them. In fact, the workflow is as follows:

1. Try to install gcc first. You will get conflicts.
2. Download the necessary rpms. Try to install them. If you get conflicts again, repeat the step.
3. When you satisfy all the conflicts you should finally have gcc installed.

Here are some more rpms I had to download from ftp.altlinux.org and install to make the gcc work for me:
gcc4.1-4.1.1-alt11.i586.rpm
gcc4.1-c++-4.1.1-alt11.i586.rpm
gcc-c++-common-1.4.10-alt2.i586.rpm
glibc-2.5-alt4.i586.rpm
glibc-devel-2.5-alt4.i586.rpm
glibc-kernheaders-2.6.17-alt6.i586.rpm
iconv-2.5-alt4.i586.rpm
kernel-headers-common-1.1.9-alt1.i586.rpm

Finally, I got the ./configure --enable-rewrite command work for Apache.

Then I execute:

make
make install
/usr/local/apache2/bin/apachect1 start

That’s all to have apache installed. The document directory is at /usr/local/apache2/htdocs and the site can be accessed by localhost.localdomain

Installing MySQL:

Download the source distribution for mysql, extract and run the configure command:

./configure --prefix=/usr/local/mysql --with-named-curses-libs=/usr/lib/ncurses.so.5.6

I had to add --with-named-curses-libs, because the configure generated error on my ALT Linux 4.0 Lite:

No curses/termcap library found

I’ve installed libncurses-devel-5.6-alt3.i586.rpm

Follow instructions listed here:

Installation from source distribution

Installing php.

I’ve downloaded the most recent version from php.net: php 5.2.8

Extracted the tar.gz and entered into the directory. Tried ./configure, but it failed with errors.

Then had to install some rpms to make configure work:

zlib-devel-1.2.3-alt4.i586.rpm
libxml2-devel-2.6.28-alt1.i586.rpm

The configure command:

./configure --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache2/bin/apxs

Then:

make
make install
cp php.ini-dist /usr/local/lib/php.ini

Then edit apache httpd.conf file:

LoadModule php5_module modules/libphp5.so

And add handler for mime type:

AddType application/x-httpd-php .php .phtml

Restart apache.

Comments (2)