Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthordelia
     
    Hi all,

    do you know if there is in Akelos a function to create an url alias for a title, deleting all punctuation, spaces, etc....?? I need it to include the title of a news item in the url...
    Thanks!
    • CommentAuthorarnoschn
     
    Hi Delia,

    I just added a plugin called acts_as_sluggable to the akelos trunk. We are using it in some projects and would like to share it. If you are using a recent akelos trunk version you can do the following to install the plugin in your application:

    ./script/plugin install acts_as_sluggable

    Simple Usage example from the README:

    class MyModel extends ActiveRecord
    {
    var $acts_as = array('sluggable'=>array('slug_source'=>'title','slug_target'=>'slug'));
    }

    if you have the following model:

    $model = new MyModel();
    $model->title = "Vacations in France";
    $model->save();

    the $model->slug will be generated as:

    echo $model->slug;
    ----
    vacations-in-france
    ----

    $model2 = new MyModel();
    $model2->title = "Vacations in France";
    $model2->save();

    will now have:

    echo $model2->slug;
    ----------------------
    vacations-in-france-1
    ---------------------


    Be aware that the column "slug" must exist of course.

    Hope that helps.

    Arno
    • CommentAuthordelia
     
    thanks arnoschn,
    it's just what i needed!!!
    • CommentAuthordelia
     
    hi arnoschn,
    i am using your plugin without any problem, except for titles with an "ñ". When an "ñ" is found, the slug is truncated... any idea?
    • CommentAuthordelia
     
    ... when the title has an accent it occurs too ...