Fork me on GitHub

Short-URLs  Bottom

  • Hello,

    Yesterday I upgraded (at my computer) my site to Zikula 1.2.3 and I installed for the very first time the crpTag module, a component for tagging items, based on hooks.

    Once installed and activated, when I write an article at the News module, I have the possibility to add tags related to this content. So, for example, if I publish an article about Europe, I can add tags like 'uk', 'france', 'italy' or 'sweden'.

    I use directory based short-URLs, so the URL of the tags are:

    where 'x' is the id of the tag ('1', '2', '3', '4', etc)

    I'm trying to rewrite this type of URL for something like that:

    where 'tagname' should be, as I referred previously, 'uk', 'france' or whatever word.

    And here is the problem. I can't do it and I don't know why.

    These are the lines I've added to the .htaccess file:

    Quote

    # Rules for Tags
    RewriteRule ^tags/([^-]+)$ index.php?module=crpTag&func=display&id=$1 [L,NC,NS]


    And these are the ones I've added to my outputfilter.myurls.php file, located at 'themes/mytheme/plugins/' directory (note: I created this file a year ago when I installed Zikula 1.1.0 and, since then, I've rewrited succesfully the URLs of some modules):

    Quote

    function smarty_outputfilter_myurls($source, &$Smarty)
    {
    $baseurl = pnGetBaseURL();
    $type = FormUtil::getPassedValue('type', 'user', 'GETPOST');
    $extension = pnConfigGetVar('shorturlsext');
    $prefix = '|"(?:'.$baseurl.')?';
    $entrypoint = pnConfigGetVar('entrypoint', 'index.php');

    $in = array(
    $prefix . $entrypoint . '\?module=crpTag&(?:amp;)?func=display&(?:amp;)?id=([\w\d\.\:\_\/]+)"|',
    );

    $out = array(
    '"tags/$1"',
    );

    // perform the replacement
    $source = preg_replace($in, $out, $source);

    // return the (modified) source
    return $source;
    }


    I suppose that I'm doing something wrong, but I don't know exactly what. Any idea?

    Thanks in advance.



    edited by: Abadia, datetimebrief

This list is based on users active over the last 60 minutes.