Sunday, July 31, 2011

Tip 10: Modifying Tiki SEFURL for Page of Edit Article



You have already known how to modify SEFURL for print article. The following tip will help you in modifying SEFURL for editing article. Follow the steps below.
  1. Open file /tiki-sefurl.php. Insert the script below, exactly before the script if ($type == 'blog' && $prefs['feature_sefurl_title_blog'] == 'y' && empty($with_next)) {:
  2. if ($type == 'edit_article' && $prefs['feature_sefurl_title_article'] == 'y' && empty($with_next)) {
    global $artlib;
    include_once ('lib/articles/artlib.php');
    if (preg_match('/articleId=([0-9]+)/', $tpl_output, $matches)) {
    if (empty($title)) $title = $artlib->get_title($matches[1]);
    $title = preg_replace(PATTERN_TO_CLEAN_TEXT, CLEAN_CHAR, $tikilib->take_away_accent($title));
    $title = preg_replace('/' . CLEAN_CHAR . CLEAN_CHAR . '+/', '-', $title);
    $title = preg_replace('/' . CLEAN_CHAR . '+$/', '', $title);
    }
    }
    Save and close file /tiki-sefurl.php.
  3. Open file /lib/smarty_tiki/modifier.sefurl.php. Insert the script below, exactly before the script case 'file':
  4. case 'edit_article':
    $href = 'tiki-edit_article.php?articleId='.$source;

    break;
    Save and close file /lib/smarty_tiki/modifier.sefurl.php.
  5. Open file .htaccess. The default file name when the first time Tiki installed was _htaccess. Therefore, if you find file name _htaccess, rename it with .htaccess. The file location of .htaccess should be in the root or main directory of your web domain (e.g: http://www.example.com).
  6. Insert the script RewriteRule ^edit_article([0-9]+)\-.*$ edit_article$1
    right under the script RewriteRule ^article([0-9]+)\-.*$ article$1
  7. Insert the script RewriteRule ^edit_article([0-9]+)(.*) tiki-edit_article.php?articleId=$1$2 [L]
    right under the script RewriteRule ^article([0-9]+)(.*) tiki-read_article.php?articleId=$1$2 [L].
    Save and close file .htaccess
  8. Open phpMyAdmin and your Tiki database, then open table tiki_sefurl_regex_out.
  9. Insert one row/record in the last order with the columns/field as follow:
    1. Left: tiki-edit_article.php\?articleId=(\d+)
    2. Right: edit_article$1
    3. Type: article
    4. Feature: feature_articles
    5. Leave other fields as they are.
  10. Save and close table tiki_sefurl_regex_out.
  11. Open file /templates/article_trailer.tpl.
  12. Edit or change script <a class="icon" href="tiki-edit_article.php?articleId={$articleId}">{icon _id='page_edit'}</a> with script <a class="icon" href="{$articleId|sefurl:edit_article}">{icon _id='page_edit'}</a>
  13. Save and close /templates/article_trailer.tpl.
  14. Finish. Your SEFURL for editing article is ready.

No comments:

Post a Comment