b2evo: change default text for read more and follow up

by prettyscripts on 2010-03-10 14:37:27 • Leave a comment »

phpb2evolution

based on the source code (this is V2.4, but it's similar in V3), you need to set correct parameters for $Item->more_link(). the parameters are link_text (defaults to 'Read more') and anchor_text (defaults to 'Follow up').

for most skins this function is called in _item_content.inc.php. if this file does not exist in your skin, copy it from parent directory (do not edit the file from parent directory directly!)

locate $Item->more_link() and edit:

PHP:

$Item->more_link(array(
    .... // existing code
    'link_text' => param['more_link_text'],
    'anchor_text' => param['anchor_text'], // add this
));

look for files in skin where it includes skin file _item_content.inc.php and add to param:

PHP:

skin_include('_item_content.inc.php'array(
    .... // existing parameters
    'more_link_text' => 'text to replace Read more',
    'anchor_text' => 'text to replace Follow up',
));

Tags: b2evo, more, skin

b2evo: author links to website instead of user page

by prettyscripts on 2010-03-09 11:47:53 • Leave a comment »

phpb2evolution

in the skin, the function call to show author of a post is $Item->author(). by default it links to user page. i wanted to link to user's website. there aren't much information on how to use this function and the doc is outdated.

source code is always the best documentation. the function is defined in inc/items/models/_item.class.php. it seems these are new array parameters introduced in V3.

one of which is link_to. the default is userpage. another available option is userurl - this is what you want.

depends on the skins, locate any files that calls $Item->author() and add 'link_to':

PHP:

$Item->author(array(
    ..... // whatever the current skin uses
    'link_to'  => 'userurl'// add this
));

the author text now links to website, if defined in user setting in backoffice.

Read more »

Tags: author, b2evo, link, skin

symfony and doctrine: default table collation, a better solution

by prettyscripts on 2010-03-08 11:09:13 • Leave a comment »

symfony

as of symfony 1.4 and if working with doctrine, there are still problem setting default and correct table encoding and collations with symfony doctrine:build task.

i have previously posted 2 solution. the 1st involves hacking the core code, which needs to be done with every symfony upgrade. the 2nd involves adding options to set default encoding and collation in schema.yml, which has to be done on every table! with the latter, tables created by plugins won't have the correct encoding. you will ended up with a database of tables with mixed collations.

i believe i have found a better solution. add a function to 'config/ProjectConfiguration.class.php':

PHP:

public function configureDoctrine(Doctrine_Manager $manager) {
    $manager->setCollate('utf8_unicode_ci');
    $manager->setCharset('utf8');
}

Tags: collation, database, doctrine, encoding, symfony

symfony: sfDoctrineGuardPlugin and customizing user profile

by prettyscripts on 2010-03-03 11:43:54 • Leave a comment »

symfony

sfDoctrineGuardPlugin provides basic authentication. sf_guard_user table only contains minimal fields to make this feature work. all other user relevant information such as name, birthday, contact numbers etc require a new table sf_guard_user_profile that works with this.

however at the moment user profile setup is poorly documented from the official plugin page.

further information can be found here on how to customize the user profile for frontend and backend. note that this was written for symfony V1.2, some commands maybe be obsoleted and needed to be replaced with newer commands.

here are some main points from the document.

Read more »

Tags: doctrine, profile, symfony, user

symfony plugin: install and uninstall manually

by prettyscripts on 2010-03-02 12:42:43 • 1 comment »

symfony

symfony's command line plugin install and uninstall tasks don't work - this could be because the server i'm working on does not have internet connection. so i have to do things manually.

manual install

  • download the package from plugins site (if not previously downloaded)
  • unzip / untar the file. if the directory contain version number, rename it.
  • copy the directory to /path/to/your/project/plugins.
  • do the normal setup
    • edit config/ProjectConfiguration.class.php to add the new plugin
    • run symfony plugin:publish-assets

manual uninstall

  • delete the plugin directory from /path/to/your/project/plugins
  • edit config/ProjectConfiguration.class.php to remove the plugin
  • run symfony plugin:publish-assets
  • search for any other 'traces' of this plugin, if running from unix server, from project root, run find . -name "name_of_plugin*" -print. adding '*' to the name make sure you will not miss any files.
  • if there are any files and diretories with this plugin name, delete them
  • run symfony cc to clear everything

Tags: install, plugin, symfony, uninstall